README.md

SPprm

 ## install the package
 devtools::install_github('baolinwu/SPprm')
 library(SPprm)
 ## simulate PRM data
 n = 20;  m = 10
 s2w = s2b = 4;  mu = 1
 e = matrix(rnorm(n*m), n,m)*sqrt(s2w)
 u = rnorm(n)*sqrt(s2b)
 X = mu + u + e
 ## QMS test
 rho = sqrt(s2w+s2b+mu^2)
 PRMtest(X, rho)$p.val
 PRMtest(X, rho+0.75)$p.val
 ## power calculation
 ## analytical calc
 PRMap(alpha=0.05,n, m, s2w, s2b, mu, rho+0.75)$pwr
 ## Monte Carlo sim
 PRMmcp(alpha=0.05,n, m, s2w, s2b, mu, rho+0.75)$pwr
 ## sample size calc
 aa = PRMas(pwr=0.8,alpha=0.05, m,s2w, s2b, mu, rho+0.75)
 aa
 ## PRMap(alpha=0.05,n=aa$n, m, s2w, s2b, mu, rho+0.75)$pwr
 PRMmcp(alpha=0.05,n=aa$n, m, s2w, s2b, mu, rho+0.75)$pwr

 ## analyze the oxymetry comparison data
 data(poData)
 RMSt(poData$Y,poData$A)



baolinwu/SPprm documentation built on May 9, 2019, 8:41 a.m.