Checking pQF vs SKAT In bigQF: Quadratic Forms in Large Matrices

Here we're checking the sparse-matrix version of `pQF` on a really unsuitably small example with 67 markers, because it's the one that comes with the `SKAT` package: see `help(SKAT)`

```library(SKAT)   #CRAN
library(bigQF)  #github/tslumley
set.seed(2018-5-18)
```

First example: continuous phenotype, no adjustment

```data(SKAT.example)
attach(SKAT.example) #look, it's not my fault, that's how they did it.

obj<-SKAT_Null_Model(y.c ~ 1, out_type="C")
skat.out1<-SKAT(Z, obj)
skat.qf1a<-SKAT.matrixfree(Z)
skat.qf1b<-SKAT.matrixfree(Z,model=lm(y.c~1))
skat.qf1c<-SKAT.matrixfree(Z,model=glm(y.c~1))

skat.out1\$Q
skat.qf1a\$Q(y.c)
skat.qf1b\$Q()    ## phenotype used in fitting
skat.qf1b\$Q(y.c) ## new phenotype

skat.out1\$p.value
pQF(skat.out1\$Q,skat.qf1a,neig=60,convolution.method="integration" )
pQF(skat.out1\$Q,skat.qf1b,neig=60,convolution.method="integration" )
pQF(skat.out1\$Q,skat.qf1c,neig=60,convolution.method="integration" )
```

The warning indicates the remainder term in the approximation has been dropped, which is appropriate. If you don't specify `convolution.method` the default is the saddlepoint approximation -- the impact is in the third decimal place.

And more systematically

```set.seed(2018-5-18)
p<-lapply(1:65, function(k) pQF(skat.out1\$Q, skat.qf1a, neig=k,
convolution.method="integration",tr2.sample.size=1000 )
)
pdf<-data.frame(p=do.call(c,p),k=1:65)
plot(p~k,data=pdf,pch=19,col="orange", ylim=c(0.017,0.020))
abline(h=skat.out1\$p.value,lty=2)
```

Try the bigQF package in your browser

Any scripts or data that you put into this service are public.

bigQF documentation built on Nov. 23, 2021, 5:06 p.m.