| gsearlyFit | R Documentation |
Fits a generalized least squares model using function gls
(from package nlme)
gsearlyFit(data, datanames = c("id","atime","catime",
"intervention","outcome"), cmodel=FALSE, vmodel=TRUE, method="ML",
full=FALSE)
data |
A data frame structured as function |
datanames |
Names of the five required data variables; participant,
time-point, standardized (continuous) time-point (see
|
cmodel |
The correlation model is set to |
vmodel |
The variance model is set to either |
method |
Either "ML" for maximum likelihood or "REML" for restricted maximum likelihood estimation; with default "ML" |
full |
Either |
Either a gls model (full=TRUE) or a summary of the model fit
(full=FALSE), which is a list with the components.
parameters |
Estimates of variance of beta (vbeta), beta and z (z=beta/sqrt(vbeta)). |
model |
A list comprised of the data sample size |
gsearlySimulate, simdataExtract,
modelParameters
# Model for full data set
data(qol)
mod.fulldata <- nlme::gls(QoL~(Weeks-1)+(Weeks-1):Treat, data=qol,
correlation=nlme::corSymm(form=~1|Subject),
weights=nlme::varIdent(form =~1|Weeks), method="ML")
summary(mod.fulldata)
# Use data available at day 150
data.interim1 <- qol[qol$Day<=150,]
mod.interim1 <- nlme::gls(QoL~(Weeks-1)+(Weeks-1):Treat, data=data.interim1,
correlation=nlme::corSymm(form=~1|Subject),
weights=nlme::varIdent(form=~1|Weeks), method="ML")
summary(mod.interim1)
# Use glsFit
gsearlyFit(qol, datanames=c("Subject","Weeks","STime","Treat","QoL"))
# vbeta
vcov(mod.fulldata)[6,6]
# beta
coef(mod.fulldata)[6]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.