# SKAT.matrixfree: Make 'matrix-free' object for SKAT test In bigQF: Quadratic Forms in Large Matrices

## Description

'Matrix-free' or 'implicit' linear algebra uses a matrix only through the linear operations of multiplying by the matrix or its transpose. It's suitable for sparse matrices, and also for structured matrices that are not sparse but still have fast algorithms for multiplication. The Sequence Kernel Association Test is typically performed on sparse genotype data, but the matrix involved in computations has been centered and is no longer sparse.

## Usage

 ```1 2 3 4 5 6 7``` ```SKAT.matrixfree(G,weights=function(maf) dbeta(maf,1,25), model=NULL,...) ## S3 method for class 'lm' SKAT.matrixfree(G,weights=function(maf) dbeta(maf,1,25), model=NULL,...) ## S3 method for class 'glm' SKAT.matrixfree(G,weights=function(maf) dbeta(maf,1,25), model=NULL,...) ## S3 method for class 'lmekin' SKAT.matrixfree(G,weights=function(maf) dbeta(maf,1,25), model=NULL, kinship,...) ```

## Arguments

 `G` A 0/1/2 matrix whose columns are markers and whose rows are samples. Should be mostly zero. `weights` A weight function used in SKAT: the default is the standard one. `model` A linear model, generalised linear model, or `lmekin` object used for adjustment, or `NULL` `kinship` A (sparse) kinship matrix. The `model` will have used `2*kinship` in its `varlist` argument. `...` to keep CMD check happy

## Details

If the adjustment model is `NULL` the object contains the trace of the underlying quadratic form, if the adjustment model is not `NULL` the trace will be estimated using Hutchinson's randomised estimator inside `pQF`. The `lmekin` method calls `famSKAT`.

## Value

An object of class `matrixfree`

Thomas Lumley

## References

Lee, S., with contributions from Larisa Miropolsky, and Wu, M. (2015). SKAT: SNP-Set (Sequence) Kernel Association Test. R package version 1.1.2.

Lee, S., Wu, M. C., Cai, T., Li, Y., Boehnke, M., and Lin, X. (2011). Rare-variant association testing for sequencing data with the sequence kernel association test. American Journal of Human Genetics, 89:82-93.

Wu, M. C., Kraft, P., Epstein, M. P., Taylor, D. M., Channock, S. J., Hunter, D. J., and Lin, X. (2010). Powerful SNP set analysis for case-control genome-wide association studies. American Journal of Human Genetics, 86:929-942.

`pQF` `sparse.matrixfree`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```data(sequence) skat<-SKAT.matrixfree(sequence) skat\$trace pQF(c(33782471,7e7,1e8), skat,n=100, tr2.sample.size=500) data(SKAT.example) skat1mf <- SKAT.matrixfree(SKAT.example\$Z) (Q<-skat1mf\$Q(SKAT.example\$y.c)) all.equal(as.numeric(Q), 234803.786) ## correct value is 0.01874576 pQF(Q, skat1mf, neig=4, convolution.method="integration") skat3mf <- SKAT.matrixfree(SKAT.example\$Z, model=lm(y.c~X, data=SKAT.example)) (Q<-skat3mf\$Q()) all.equal(Q, 298041.542) ## correct value is 0.002877041 pQF(Q, skat3mf, neig=4, convolution.method="integration") ```