# jackstraw.FUN: Non-Parametric Jackstraw for a Custom Function In jackstraw: Statistical Inference of Variables Driving Systematic Variation

## Description

Estimates statistical significance of association between variables and their latent variables, estimated using a custom function.

## Usage

 ```1 2 3``` ```jackstraw.FUN(dat, FUN, 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 data matrix with `m` rows as variables and `n` columns as observations. `FUN` optionally, provide a specfic function to estimate LVs. Must output `r` estimated LVs in a `n*r` matrix. `r` a number of significant latent variables. `r1` a numeric vector of latent variables of interest. `s` a number of “synthetic” null variables. Out of `m` variables, `s` variables are independently permuted. `B` a number of resampling iterations. `covariate` a model matrix of covariates with `n` observations. Must include an intercept in the first column. `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 principal components `obs.stat` `m` observed statistics `null.stat` `s*B` null statistics

## Author(s)

Neo Christopher Chung [email protected]

## References

Chung and Storey (2013) Statistical Significance of Variables Driving Systematic Variation in High-Dimensional Data. arXiv:1308.6013 [stat.ME] http://arxiv.org/abs/1308.6013

 ``` 1 2 3 4 5 6 7 8 9 10``` ```set.seed(1234) ## simulate data from a latent variable model: Y = BL + E B = c(rep(1,50),rep(-1,50), rep(0,900)) L = rnorm(20) E = matrix(rnorm(1000*20), nrow=1000) dat = B %*% t(L) + E dat = t(scale(t(dat), center=TRUE, scale=TRUE)) ## apply the jackstraw with the svd as a function out = jackstraw.FUN(dat, FUN = function(x) svd(x)\$v[,1,drop=FALSE], r=1, s=100, B=50) ```