Title: | Localised Co-Dependency Analysis |
---|---|
Description: | Performs model fitting and significance estimation for Localised Co-Dependency between pairs of features of a numeric dataset. |
Authors: | Ed Curry [aut, cre] |
Maintainer: | Ed Curry <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2025-02-13 03:41:03 UTC |
Source: | https://github.com/cran/LCA |
Estimates initial value of parameter Beta from the PTL distribution used in LCA analysis.
estimateB(x)
estimateB(x)
x |
Numeric vector of differences between the values of each feature, for a pair of objects in the dataset. |
Calculates maximum-likelihood estimate for Beta in the Laplace distribution fit to distribution of x
.
Numeric value for initial estimate of PTL distribution parameter Beta
Ed Curry [email protected]
Use PTL model to estimate the significance of a difference between the values of some feature of interest in two selected objects from a dataset.
evaluateDiffSignificance(d,diff,PTLmodel)
evaluateDiffSignificance(d,diff,PTLmodel)
d |
Numeric value specifying global dissimilarity between the selected objects |
diff |
Numeric value specifying magnitude of difference between the values of a selected feature of interest in the selected objects |
PTLmodel |
List, as returned by the function |
Evaluates statistical significance of observing as great a difference as that observed between the values of a selected feature of interest in the selected objects, given the global dissimilarity between those objects and the PTL models fitted to characterise these distributions across the whole dataset.
Numeric value giving p-value representing significance estimate of the observed difference, given the fitted models.
Ed Curry [email protected]
Fits PTL models to randomly sampled pairs of the dataset, to enable prediction of PTL model parameter values based on hyperparameter d
.
fitPTLmodel(x,nPairs=10000)
fitPTLmodel(x,nPairs=10000)
x |
Numeric data input array, standardised to range (0,1) |
nPairs |
Numeric value specifying the number of samplings of pairs of objects to use to obtain hyperparameter fits |
Evaluates parameters for PTL model fits to the distributions of feature-wise differences between each of a specified (large) number of pairs of objects represented in dataset x
. Obtains subsequent model fits explaining the individual PTL parameters alpha
,beta
,gamma
in terms of the global (Euclidean) distances between the corresponding pairs of objects.
List with the following components:
alpha |
Object of class |
beta |
Object of class |
gamma |
Object of class |
Ed Curry [email protected]
Predicts the expected number of features with a difference between two objects of a given global dissimilarity lying within a set of specified ranges.
getPTLExpectedCounts(alpha,beta,gamma,bin_limits,ntrials)
getPTLExpectedCounts(alpha,beta,gamma,bin_limits,ntrials)
alpha |
Numeric value specifying the parameter |
beta |
Numeric value specifying the parameter |
gamma |
Numeric value specifying the parameter |
bin_limits |
Numeric vector specifying the limits of each range to be evaluated. Effectively, this gives the breakpoints between cells of the predicted histogram. |
ntrials |
Numeric value specifying the number of features being evaluated in the dataset |
Uses a PTL model with the specified parameters to estimate the expected number of features with differences between specified ranges. Used in calibration of PTL model parameter prediction to the dataset.
Numeric vector giving expected counts for numbers of features with a difference lying within the given set of specified ranges.
Ed Curry [email protected]
Finds parameters alpha
, beta
and gamma
in PTL model to fit an observed distribution of differences in each feature's values between two given objects from a dataset.
getPTLparams(x1,x2)
getPTLparams(x1,x2)
x1 |
Numeric data input vector, standardised to range (0,1) |
x2 |
Numeric data input vector, standardised to range (0,1) |
Uses iterative NLS fitting to determine parameters of PTL model to represent the distribution of the differences observed between two objects selected from the dataset being analysed with LCA.
List with the following elements:
d |
Numeric value specifying pair-wise global distance between objects |
beta |
Numeric value specifying value of parameter |
alpha |
Numeric value specifying value of parameter |
gamma |
Numeric value specifying value of parameter |
Ed Curry [email protected]
Performs Localised Co-dependency Analysis
LCA(x,PTLmodel,clique,seed.row,combine.method="Fisher", adjust.method="BH",comparison.alpha=0.05)
LCA(x,PTLmodel,clique,seed.row,combine.method="Fisher", adjust.method="BH",comparison.alpha=0.05)
x |
Numeric data input array, standardised to range (0,1) |
PTLmodel |
List with named elements |
clique |
Numeric vector specifying which columns of data table represent entities defining the clique across which to evaluate co-dependency |
seed.row |
Numeric value specifying which row of data table to use as 'seed' feature with which to evaluate co-dependency |
combine.method |
Character specifying which method to use for combining individual LCD estimates. One of "Fisher" or "Inverse Product". |
adjust.method |
Character specifying which method to use for multiple testing adjustment of significance estimates. See |
comparison.alpha |
Significance level threshold for including objects in the set to be used for evaluating LCD significance estimates for a given pair of features in a given clique. |
Function to evaluate LCD, within the members of clique
, for all features in a dataset against the feature represented by seed.row
.
List with elements:
LCD |
Data frame giving across-clique LCD significance estimates for each feature in the dataset, as both unadjusted p-value and adjusted for multiple testing. |
combinations |
An array detailing the individual pair-wise LCD tests performed amongst members of the clique, which were combined to give the overall significance estimates |
Ed Curry [email protected]
suppressWarnings(RNGversion("3.5.0")) ## create a data matrix x <- array(runif(1200),dim=c(40,12)) ## implant similarity across a 'clique' clique.cols <- sample(ncol(x),4) x[,clique.cols] <- x[,clique.cols] + rnorm(nrow(x)) ## scale x to (0,1) x[x<0] <- 0 x[x>1] <- 1 ## choose a 'seed' feature and some partner seed.row <- sample(nrow(x),1) partner.row <- sample(setdiff(c(1:nrow(x)),seed.row),1) x[c(seed.row,partner.row),clique.cols] <- x[c(seed.row,partner.row),clique.cols] + rep(rnorm(length(clique.cols)),each=2) ## calibrate PTL models to dataset PTL.fit <- fitPTLmodel(x,nPairs=15) ## evaluate LCD between 'seed' feature and all other features LCA.result <- LCA(x,PTLmodel=PTL.fit,clique=clique.cols,seed.row=seed.row) ## Not run: head(LCA.result$LCD)
suppressWarnings(RNGversion("3.5.0")) ## create a data matrix x <- array(runif(1200),dim=c(40,12)) ## implant similarity across a 'clique' clique.cols <- sample(ncol(x),4) x[,clique.cols] <- x[,clique.cols] + rnorm(nrow(x)) ## scale x to (0,1) x[x<0] <- 0 x[x>1] <- 1 ## choose a 'seed' feature and some partner seed.row <- sample(nrow(x),1) partner.row <- sample(setdiff(c(1:nrow(x)),seed.row),1) x[c(seed.row,partner.row),clique.cols] <- x[c(seed.row,partner.row),clique.cols] + rep(rnorm(length(clique.cols)),each=2) ## calibrate PTL models to dataset PTL.fit <- fitPTLmodel(x,nPairs=15) ## evaluate LCD between 'seed' feature and all other features LCA.result <- LCA(x,PTLmodel=PTL.fit,clique=clique.cols,seed.row=seed.row) ## Not run: head(LCA.result$LCD)
Evaluates Statistical Significance of Localised Co-Dependency (LCD)
LCD(x1,x2,seed.row,PTLmodel)
LCD(x1,x2,seed.row,PTLmodel)
x1 |
Numeric data vector giving values of all features for one selected object |
x2 |
Numeric data vector giving values of all features for another selected object |
seed.row |
Numeric value specifying which row of data table to use as 'seed' feature with which to evaluate co-dependency |
PTLmodel |
List with named elements |
Function to evaluate LCD, between two selected objects, for all features in a dataset against the feature represented by seed.row
.
Numeric vector giving p-values for significance estimates of localised co-dependency, with the feature specified by seed.row
, of all features in the dataset being analysed.
Ed Curry [email protected]
Generates parameter values for PTL model, based on a specified value of the hyperparameter
predictPTLparams(d,PTLmodel)
predictPTLparams(d,PTLmodel)
d |
Numeric value specifying global dissimilarity between the selected objects |
PTLmodel |
List, as returned by the function |
Uses hyperparameter-based prediction linear models, calibrated to the dataset being analysed using the fitPTLmodel
function, to estimate PTL model parameters for a pair of objects in the dataset with a global dissimilarity d
.
List with elements:
alpha |
Numeric value specifying the parameter |
beta |
Numeric value specifying the parameter |
gamma |
Numeric value specifying the parameter |
Ed Curry [email protected]
Probability density and distribution functions for Polynomial-Tail Laplace distribution
dPTL(x,alpha,beta,gamma) pPTL(q,alpha,beta,gamma)
dPTL(x,alpha,beta,gamma) pPTL(q,alpha,beta,gamma)
x , q
|
Numeric vector of quantiles |
alpha |
Linear tail adjustment coefficient for PTL distribution |
beta |
Exponential decay term for PTL distribution, similar to |
gamma |
Polynomial tail adjustment coefficient for PTL distribution |
The PTL distribution has density
dnorm
gives the density,
pnorm
gives the distribution function.
The length of the result is the maximum of the lengths of the numerical parameters for the other functions. The numerical parameters are recycled to the length of the result.
Ed Curry [email protected]