I am taking a course, and am trying to figure out how an answer was obtained, but have not gotten any assistance from the mentors.
The question asks data to be loaded from the snpStats package, run an additive logistic model for each SNP, and find the average, minimum and maximum effect.
library(snpStats) library(broom) data(for.exercise) use<-seq(1,ncol(snps.10),10) sub.10<-snps.10[,use] snpdata=sub.10@.Data status=subject.support$cc snp.rhs.tests(status~1, snp.data=sub.10)
I obtain a result, but I do not get the correct answer (0.007, -4.25 and 3.90 respectively). I made a matrix of genotypes using an iterative function and adding the numeric values for each SNP to the matrix, then replacing the 0 values with NA. But the resulting table when used in the code below throws an error.
Error in snp.rhs.tests(status ~ snps, snp.data = sub.10) : no observations
I also tried
snp.rhs.estimates(status~1, snp.data=sub.10)
but cannot figure out how to isolate just the beta and z values from the resulting list of lists to see if that is where the answer lies.
> sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)
Any assistance would be greatly appreciated.
NatalieI