Learn R Programming

jackstraw (version 1.1)

jackstraw.LFA: Non-Parametric Jackstraw for Logistic Factor Analysis

Description

Estimates statistical significance of association between variables and their logistic factors (LFs).

Usage

jackstraw.LFA(dat, FUN = function(x) lfa(x, r)[, , drop = FALSE],
  devR = FALSE, r = NULL, r1 = NULL, s = NULL, B = NULL,
  covariate = NULL, compute.obs = TRUE, compute.null = TRUE,
  compute.p = TRUE, verbose = TRUE, seed = NULL)

Arguments

dat

a genotype matrix with m rows as variables and n columns as observations.

FUN

a function to use for LFA (by default, it uses the lfagen package)

devR

use a R function to compute deviance. By default, FALSE (uses C++).

r

a number of significant LFs.

r1

a numeric vector of LFs of interest (implying you are not interested in all r LFs).

s

a number of ``synthetic'' null variables. Out of m variables, s variables are independently permuted.

B

a number of resampling iterations. There will be a total of s*B null statistics.

covariate

a data matrix of covariates with corresponding n observations (do not include an intercept term).

compute.obs

a logical specifying to return observed statistics. By default, TRUE.

compute.null

a logical specifying to return null statistics obtained by the jackstraw method. By default, TRUE.

compute.p

a logical specifying to return p-values. By default, TRUE.

verbose

a logical specifying to print the computational progress.

seed

a seed for the random number generator.

Value

jackstraw returns a list consisting of

p.value

m p-values of association tests between variables and their LFs

obs.stat

m observed devs

null.stat

s*B null devs

Details

This function uses logistic factor analysis (LFA) from Wei et al. (2014). Particularly, dev in logistic regression (the full model with r LFs vs. the intercept null model) is used to assess association.

See Also

jackstraw jackstraw.FUN

Examples

Run this code
# NOT RUN {
set.seed(1234)
# }
# NOT RUN {
## simulate genotype data from a logistic factor model: drawing rbinom from logit(BL)
m=5000; n=100; pi0=.9
m0 = round(m*pi0)
m1 = m-round(m*pi0)
B = matrix(0, nrow=m, ncol=1)
B[1:m1,] = matrix(runif(m1*n, min=-.5, max=.5), nrow=m1, ncol=1)
L = matrix(rnorm(n), nrow=1, ncol=n)
BL = B %*% L
prob = exp(BL)/(1+exp(BL))

dat = matrix(rbinom(m*n, 2, as.numeric(prob)), m, n)

## apply the jackstraw
out = jackstraw.LFA(dat, r=2)
# }

Run the code above in your browser using DataLab