% \VignetteIndexEntry{AIDS - Semiparametric Mixed Model} % \VignetteDepends{mgcv} %\VignetteEngine{knitr::knitr} %\VignetteEncoding{UTF-8} \documentclass[a4paper]{article} \title{AIDS - Semiparametric Mixed Model} \begin{document} \maketitle <>= options(width=80) @ The "AIDS"--data from "catdata" are loaded. <>= library(catdata) data(aids) @ As for normal GAMs for GAMMs the package "mgcv" is used. <>= library(mgcv) @ The Semiparametric Mixed Model (or Generalized Additive Mixed Model) for "AIDS"--Data is fitted by the function "gamm". Here the only random effect is the random intercept. <>= gammaids<-gamm(cd4 ~ s(time) + drugs + partners + s(cesd) + s(age), random=list(person=~1), family=poisson(link=log), data=aids) @ The summary of the fixed effects is printed. <>= summary(gammaids$gam) @ Finally the three smooth effects from the gam are plotted. <>= plot(gammaids$gam,ylab=" ",cex.lab=1.8,cex.axis=1.5,select=1) @ <>= plot(gammaids$gam,ylab=" ",cex.lab=1.8,cex.axis=1.5,select=2) @ <>= plot(gammaids$gam,ylab=" ",cex.lab=1.8,cex.axis=1.5,select=3) @ <>= detach(package:mgcv) @ \end{document}