View source: R/functions_gofLMM.R
gof.lmm.pan | R Documentation |
Obsolete. Goodness-of fit test based on cumulative sum stochastic process using the simulation approach proposed by Pan et al. Note: could equivalently obtained from gof.lmm(...,order.by.original=TRUE,type="simulation",flip.cluster=TRUE,use.sigmoid = FALSE,transform=FALSE,...)
gof.lmm.pan( fit, residuals = c("individual", "cluster"), std.type = c(1, 2), use.correction.for.imbalance = FALSE, subset.fix = NULL, M = 100, verbose = FALSE, use.normal = FALSE, use.mammen = FALSE, use.sigmoid = FALSE, lambda = 0.5 )
fit |
The result of a call to |
residuals |
Residuals to be used when constructing the process. Possible values are |
std.type |
Type of standardization to be used for the residuals when constructing the process.
Currently implemeneted options are |
use.correction.for.imbalance |
Logical. use $n_i^-1/2 S_i$ when standardizing the residuals. Defaults to |
subset.fix |
Two-sided formula. If nonnull, the process $W^F^s$ will be constructed using the variables defined on the RHS of the formula. Deafults to |
M |
Number of random simulations/sign-flipps/permutations. Defaults to |
verbose |
Logical. Print the current status of the test. Can slow down the algorithm, but it can make it feel faster. Defaults to |
use.normal |
Lolgical. Use normal random variables instead of sign-flip. Defaultes to |
use.mammen |
Logical. Use Mammen's 2 point distribution instead of sign-flip. Not in use when |
An object of class "gofLMM"
for which plot
and summary
functions are available.
Rok Blagus, rok.blagus@mf.uni-lj.si
gof.lmm
, plot.gofLMM
and summary.gofLMM
# simulate some data: N=50 set.seed(1) n<-floor(runif(N,min=1,max=15)) #imbalanced betas<-c(1,1,1,15) #don't change! #the last one is only used whe omit.important.predictor=TRUE norm.eps<-FALSE shape=0.5 scale=1 norm.re.intercept<-FALSE shape.re.intercept=0.5 scale.re.intercept=1 norm.re.slope<-FALSE shape.re.slope=0.5 scale.re.slope=1 sim.re.slope=FALSE over.parameterized.model=FALSE #i.e. fit a variable which is not used when generating the data omit.important.predictor=FALSE yy<-NA x22<-NA id<-NA x1<-NA for (gg in 1:N){ id<-c(id,rep(gg,each=n[gg])) x11<-rep(rbinom(1,size=1,prob=0.4),each=n[gg]) x1<-c(x1,x11) if (norm.re.intercept==TRUE) re.int<-rnorm(1,sd=sqrt(2)) else re.int<-rgamma(1,shape=shape.re.intercept,scale=scale.re.intercept)-shape.re.intercept*scale.re.intercept b<-rep(re.int,each=n[gg]) if (norm.re.slope==TRUE) re.slope<-rnorm(1,sd=sqrt(1)) else re.slope<-rgamma(1,shape=shape.re.slope,scale=scale.re.slope)-shape.re.slope*scale.re.slope b2<-rep(re.slope,each=n[gg]) x2<-1:n[gg] x4<-runif(n[gg]) if (norm.eps==TRUE) eps<-rnorm(n[gg]) else eps<-rgamma(n[gg],shape=shape,scale=scale)-shape*scale if (sim.re.slope==TRUE) { if (omit.important.predictor==FALSE) y<-betas[1]+betas[2]*x2+betas[3]*(x11*x2)+b+b2*x2+eps else y<-betas[1]+betas[2]*x2+betas[3]*(x11*x2)+b+b2*x2+eps+betas[4]*x4 } else { if (omit.important.predictor==FALSE) y<-betas[1]+betas[2]*x2+betas[3]*(x11*x2)+b+eps else y<-betas[1]+betas[2]*x2+betas[3]*(x11*x2)+b+eps+betas[4]*x4 } yy<-c(yy,y) x22<-c(x22,x2) } yy<-yy[-1] x22<-x22[-1] x1<-x1[-1] id<-id[-1] x4<-runif(sum(n)) aids.art<-data.frame(ptnt=id,outcome=yy,x1=x1,x2=x22,x4=x4) library(nlme) fit<-lme(fixed=outcome~ x2+x1:x2, data=aids.art, random=~x2|ptnt,control=lmeControl( returnObject = TRUE),method="REML" ) fit.gof.pan<-gof.lmm.pan(fit,residuals= "individual" ,std.type=2,use.correction.for.imbalance=FALSE,subset.fix=outcome~x2,M=25,verbose=TRUE) plot.gofLMM(fit.gof.pan,type=2,subset.M=NULL,xlab="",main="Example") summary.gofLMM(fit.gof.pan)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.