Learn R Programming

saemix (version 3.3)

saemix.plot.select: Plots of the results obtained by SAEM

Description

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

Usage

saemix.plot.select(
  saemixObject,
  data = FALSE,
  convergence = FALSE,
  likelihood = FALSE,
  individual.fit = FALSE,
  population.fit = FALSE,
  both.fit = FALSE,
  observations.vs.predictions = FALSE,
  residuals.scatter = FALSE,
  residuals.distribution = FALSE,
  random.effects = FALSE,
  correlations = FALSE,
  parameters.vs.covariates = FALSE,
  randeff.vs.covariates = FALSE,
  marginal.distribution = FALSE,
  vpc = FALSE,
  npde = FALSE,
  ...
)

Value

None

Arguments

saemixObject

an object returned by the saemix function

data

if TRUE, produce a plot of the data. Defaults to FALSE

convergence

if TRUE, produce a convergence plot. Defaults to FALSE

likelihood

if TRUE, produce a plot of the estimation of the LL by importance sampling. Defaults to FALSE

individual.fit

if TRUE, produce individual fits with individual estimates. Defaults to FALSE

population.fit

if TRUE, produce individual fits with population estimates. Defaults to FALSE

both.fit

if TRUE, produce individual fits with both individual and population estimates. Defaults to FALSE

observations.vs.predictions

if TRUE, produce a plot of observations versus predictions. Defaults to FALSE

residuals.scatter

if TRUE, produce scatterplots of residuals versus predictor and predictions. Defaults to FALSE

residuals.distribution

if TRUE, produce plots of the distribution of residuals. Defaults to FALSE

random.effects

if TRUE, produce boxplots of the random effects. Defaults to FALSE

correlations

if TRUE, produce a matrix plot showing the correlation between random effects. Defaults to FALSE

parameters.vs.covariates

if TRUE, produce plots of the relationships between parameters and covariates, using the Empirical Bayes Estimates of individual parameters. Defaults to FALSE

randeff.vs.covariates

if TRUE, produce plots of the relationships between random effects and covariates, using the Empirical Bayes Estimates of individual random effects. Defaults to FALSE

marginal.distribution

if TRUE, produce plots of the marginal distribution of the random effects. Defaults to FALSE

vpc

if TRUE, produce Visual Predictive Check plots. Defaults to FALSE (we suggest to use npdeSaemix instead)

npde

if TRUE, produce plots of the npde. Defaults to FALSE (deprecated in 3.0, please use npdeSaemix instead)

...

optional arguments passed to the plots

Author

Emmanuelle Comets emmanuelle.comets@inserm.fr, Audrey Lavenu, Marc Lavielle.

Details

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

data

A spaghetti plot of the data, displaying the observed data y as a function of the regression variable (eg time for a PK application)

convergence

For each parameter in the model, this plot shows the evolution of the parameter estimate versus the iteration number

likelihood

Estimation of the likelihood estimated by importance sampling, as a function of the number of MCMC samples

individual.fit

Individual fits, using the individual parameters with the individual covariates

population.fit

Individual fits, using the population parameters with the individual covariates

both.fit

Individual fits, using the population parameters with the individual covariates and the individual parameters with the individual covariates

observations.vs.predictions

Plot of the predictions computed with the population parameters versus the observations (left), and plot of the predictions computed with the individual parameters versus the observations (right)

residuals.scatter

Scatterplot of standardised residuals versus the X predictor and versus predictions. These plots are shown for individual and population residuals, as well as for npde when they are available

residuals.distribution

Distribution of standardised residuals, using histograms and QQ-plot. These plots are shown for individual and population residuals, as well as for npde when they are available

random.effects

Boxplot of the random effects

correlations

Correlation between the random effects, with a smoothing spline

parameters.versus.covariates

Plots of the estimate of the individual parameters versus the covariates, using scatterplot for continuous covariates, boxplot for categorical covariates

randeff.versus.covariates

Plots of the estimate of the individual random effects versus the covariates, using scatterplot for continuous covariates, boxplot for categorical covariates

marginal.distribution

Distribution of each parameter in the model (conditional on covariates when some are included in the model)

npde

Plot of npde as in package npde (deprecated in 3.0, please use npdeSaemix instead)

vpc

Visual Predictive Check (we suggest to use npdeSaemix instead)

References

E Comets, A Lavenu, M Lavielle M (2017). Parameter estimation in nonlinear mixed effect models using saemix, an R implementation of the SAEM algorithm. Journal of Statistical Software, 80(3):1-41.

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

E Comets, A Lavenu, M Lavielle (2011). SAEMIX, an R version of the SAEM algorithm. 20th meeting of the Population Approach Group in Europe, Athens, Greece, Abstr 2173.

See Also

SaemixObject,saemix, default.saemix.plots, saemix.plot.setoptions, saemix.plot.data, saemix.plot.convergence, saemix.plot.llis, saemix.plot.randeff, saemix.plot.obsvspred, saemix.plot.fits, saemix.plot.parcov, saemix.plot.randeffcov, saemix.plot.distpsi, npdeSaemix saemix.plot.scatterresiduals, saemix.plot.distribresiduals, saemix.plot.vpc

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)

# Not run (strict time constraints for CRAN)
# saemix.fit<-saemix(saemix.model,saemix.data,saemix.options)

# saemix.plot.select(saemix.fit,data=TRUE,main="Spaghetti plot of data")

# Putting several graphs on the same plot
# par(mfrow=c(2,2))
# saemix.plot.select(saemix.fit,data=TRUE,vpc=TRUE,observations.vs.predictions=TRUE, new=FALSE)

Run the code above in your browser using DataLab