Learn R Programming

saemix (version 0.96.1)

saemix.plot.data: Functions implementing each type of plot in SAEM

Description

Several plots (selectable by the type argument) are currently available: convergence plot, individual plots, predictions versus observations, distribution plots, VPC, residual plots.

Usage

saemix.plot.data(saemixObject, ...) 
saemix.plot.convergence(saemixObject,niter=0, ...) 
saemix.plot.llis(saemixObject, ...) 
saemix.plot.obsvspred(saemixObject, ...) 
saemix.plot.distribresiduals(saemixObject, ...) 
saemix.plot.scatterresiduals(saemixObject, ...) 
saemix.plot.fits(saemixObject, ...) 
saemix.plot.distpsi(saemixObject, ...) 
saemix.plot.randeff(saemixObject, ...) 
saemix.plot.correlations(saemixObject, ...) 
saemix.plot.parcov(saemixObject, ...) 
saemix.plot.randeffcov(saemixObject, ...) 
saemix.plot.npde(saemixObject, ...) 
saemix.plot.vpc(saemixObject,npc = FALSE, ...) 

saemix.plot.parcov.aux(saemixObject, partype = "p", ...) compute.sres(saemixObject) compute.eta.map(saemixObject)

Arguments

saemixObject
an object returned by the saemix function
...
optional arguments passed to the plots
npc
for VPC, computes Numerical Predictive Checks (currently not implemented)
niter
the convergence plots are shown up to iteration "niter". Defaults to 0, which indicates the convergence plots should be plotted up to the maximal number of iterations set for the algorithm
partype
(this function is not user-level)

Value

  • None

Details

These functions implement plots different graphs related to the algorithm (convergence plots, likelihood estimation) as well as diagnostic graphs. A description is provided in the PDF documentation.

saemix.plot.parcov.aux, compute.sres and compute.eta.map are helper functions, not intended to be called by the user directly.

By default, the following plots are produced: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Each plot can be customised by modifying options, either through a list of options set by the saemix.plot.setoptions function, or on the fly by passing an option in the call to the plot (see examples).

References

Kuhn, E., and Lavielle, M. Maximum likelihood estimation in nonlinear mixed effects models. Computational Statistics and Data Analysis 49, 4 (2005), 1020-1038.

Monolix32_UsersGuide.pdf (http://software.monolix.org/sdoms/software/)

See Also

SaemixObject,saemix, saemix.plot.setoptions, saemix.plot.select, plot.saemix

Examples

Run this code
data(theo.saemix)

saemix.data<-saemixData(name.data=theo.saemix,header=TRUE,sep="",na=NA, 
  name.group=c("Id"),name.predictors=c("Dose","Time"),
  name.response=c("Concentration"),name.covariates=c("Weight","Sex"),
  units=list(x="hr",y="mg/L",covariates=c("kg","-")), name.X="Time")

model1cpt<-function(psi,id,xidep) { 
	  dose<-xidep[,1]
	  tim<-xidep[,2]  
	  ka<-psi[id,1]
	  V<-psi[id,2]
	  CL<-psi[id,3]
	  k<-CL/V
	  ypred<-dose*ka/(V*(ka-k))*(exp(-k*tim)-exp(-ka*tim))
	  return(ypred)
}

saemix.model<-saemixModel(model=model1cpt,
  description="One-compartment model with first-order absorption", 
  psi0=matrix(c(1.,20,0.5,0.1,0,-0.01),ncol=3, byrow=TRUE,
  dimnames=list(NULL, c("ka","V","CL"))),transform.par=c(1,1,1),
  covariate.model=matrix(c(0,1,0,0,0,0),ncol=3,byrow=TRUE),fixed.estim=c(1,1,1),
  covariance.model=matrix(c(1,0,0,0,1,0,0,0,1),ncol=3,byrow=TRUE),
  omega.init=matrix(c(1,0,0,0,1,0,0,0,1),ncol=3,byrow=TRUE),error.model="constant")

saemix.options<-list(seed=632545,save=FALSE,save.graphs=FALSE)

saemix.fit<-saemix(saemix.model,saemix.data,saemix.options)

# Simulate data and compute weighted residuals and npde
saemix.fit<-compute.sres(saemix.fit)

# Data
saemix.plot.data(saemix.fit)

# Convergence
saemix.plot.convergence(saemix.fit)

# Individual plot for subject 1, smoothed
saemix.plot.fits(saemix.fit,ilist=1,smooth=TRUE)

# Individual plot for subject 1 to 12, with ask set to TRUE 
# (the system will pause before a new graph is produced)
saemix.plot.fits(saemix.fit,ilist=c(1:12),ask=TRUE)

# Diagnostic plot: observations versus population predictions
par(mfrow=c(1,1))
saemix.plot.obsvspred(saemix.fit,level=0,new=FALSE)

# LL by Importance Sampling
saemix.plot.llis(saemix.fit)

# Scatter plot of residuals
saemix.plot.scatterresiduals(saemix.fit)

# Boxplot of random effects
saemix.plot.randeff(saemix.fit)

# Relationships between parameters and covariates
saemix.plot.parcov(saemix.fit)

# Relationships between parameters and covariates, on the same page
par(mfrow=c(3,2))
saemix.plot.parcov(saemix.fit,new=FALSE)

# VPC, default options (10 bins, equal number of observations in each bin)
saemix.plot.vpc(saemix.fit)

# VPC, user-defined breaks for binning
saemix.plot.vpc(saemix.fit,vpc.method="user",
  vpc.breaks=c(0.4,0.8,1.5,2.5,4,5.5,8,10,13))

Run the code above in your browser using DataLab