Displaying 1 result from an estimated 1 matches for "qtn_a".
2007 Jan 21
2
efficient code. how to reduce running time?
...= rnorm(N, mean = 0, sd = 1);
# foreach sample give quantitative phenotype
# each row is a sample
# phenotype value depends on QTN genotype, pi, p, and z
Y <- sqrt(10-(10*pi))*z + QTN*sqrt((10*pi)/(2*p*(1-p)));
snp = data.frame(cbind(snp, Y));
# anova for QTN
df=data.frame(Y=Y, QTN=factor(QTN));
QTN_a <- anova(lm(Y~QTN, data=df));
print (QTN_a);
SSB <- QTN_a$`Sum Sq`[1];
SSW <- QTN_a$`Sum Sq`[2];
QTN_PRE <- SSB / (SSB + SSW);
print (paste("var_QTN/var_tot:", QTN_PRE));
# anova for all sites
F=numeric(S) #create an empty vector to store the F-values
Pval=rep(1,S) #creat...