## Not run:
# ## example using the height data provided in the package
# ## there are 7 observation times (age in years):
# data(height_data);
# tobs=c(0,1/3,2/3,1,3,4,7);
# d=200;
# sigma=1;
# g=growth(height_data,tobs,sigma,d);
#
# ## Plot of the posterior mean and credible interval for a specific individual
# indiv=1;
# ## posterior standard deviation (same for all subjects):
# postsd=sqrt(diag(g$Khat));
# plot(g$tgrid,g$muhatcurve[indiv,],type='l',
# xlab="Age (years)",ylab="Growth velocity (cms/year)");
# lines(g$tgrid,g$muhatcurve[indiv,]);
# lines(g$tgrid,g$muhatcurve[indiv,]+2*postsd,lty=2);
# lines(g$tgrid,g$muhatcurve[indiv,]-2*postsd,lty=2);
#
# ## Plot of a draw from the posterior growth velocity for a specific individual:
# draw=rmvnorm(n=1, mean=g$muhatcurve[indiv,], sigma=g$Khat, method="chol");
# plot(g$tgrid,draw,type='l',xlab="Age (years)",ylab="Growth
# velocity (cms/year)");
# ## End(Not run)
Run the code above in your browser using DataLab