# generate random data
rand_data(500,5000)
### GWAS without accounting for population structure
mod <- cGWAS(y,M)
### GWAS - accounting for population structure
## Estimate variance covariance matrix of y
G <- cgrm.A(M,lambda=0.01)
fit <- cGBLUP(y,G,verbose=FALSE)
### construct V
V <- G*fit$var_a + diag(length(y))*fit$var_e
### get the inverse square root of V
V2inv <- V %**% -0.5
### run GWAS again
mod2 <- cGWAS(y,M,V=V2inv,verbose=TRUE)
Run the code above in your browser using DataLab