-
Notifications
You must be signed in to change notification settings - Fork 0
/
RSVMMAT.Rmd
55 lines (44 loc) · 1.38 KB
/
RSVMMAT.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "RSVMMAT"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{RSVMMAT}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(RSVMMAT)
```
Use a simulated longitudinal binary phenotype and genotype data with random ascertainment and logistic model for 1000 subjects, each with 5 repeated measures. The simulated gene is the causal gene.
```{r}
p0 = rsvmmat_simu(n.sample = 1000, n.time =5, power=T)
```
Estimate null model:
```{r}
m0 = rsvmmat_est(y.long = p0$phe.long, y.cov = p0$phe.cov.long, time = p0$phe.time,phe.model=p0$phe.model)
```
Perform SVAMMT and RSVMMAT tests
```{r}
p_val = rsvmmat_test(m0, G = p0$snp.mat)
p_val
```
Use a simulated longitudinal binary phenotype and genotype data with baseline ascertainment and liability model for 1000 subjects, each with 5 repeated measures. The genes list have 10 genes that are unrelated with phenotype.
```{r}
p0 = rsvmmat_simu(n.sample = 1000, n.time =5, power=F, phe.model = 'liability', oversampling = "baseline")
```
Estimate null model:
```{r}
m0 = rsvmmat_est(y.long = p0$phe.long, y.cov = p0$phe.cov.long, time = p0$phe.time,phe.model=p0$phe.model)
```
Perform SVAMMT and RSVMMAT tests
```{r}
p_val=matrix(0,10,6)
for(i in 1:10) p_val[i,] = rsvmmat_test(m0, G = p0$snp.mat[[i]])
p_val
```