data(df1, package = 'ptmixed')
head(df1)
# 1) Quick example (just 1 quadrature point, hessian and SEs
# not computed - NB: we recommend to increase the number of
# quadrature points to obtain much more accurate estimates,
# as shown in example 2 below where we use 5 quadrature points)
# estimate the model
fit1 = ptmixed(fixef.formula = y ~ group + time, id = id,
offset = offset, data = df1, npoints = 1,
freq.updates = 200, hessian = FALSE, trace = TRUE)
# print summary:
summary(fit1, wald = FALSE)
# \donttest{
# 2) Full computation that uses more quadrature points
# for the likelihood approximation and includes numeric
# evaluation of the hessian matrix
# estimate the model:
fit2 = ptmixed(fixef.formula = y ~ group + time, id = id,
offset = offset, data = df1, npoints = 5,
freq.updates = 200, hessian = TRUE, trace = TRUE)
# print summary:
summary(fit2)
# extract summary:
results = summary(fit2)
ls(results)
results$coefficients
# }
Run the code above in your browser using DataLab