mprofile: Produce Marginal Time Profiles for Plotting

View source: R/plotrm.r

mprofileR Documentation

Produce Marginal Time Profiles for Plotting


mprofile is used for plotting marginal profiles over time for models obtained from dynamic models, for given fixed values of covariates. These are either obtained from those supplied by the model, if available, or from a function supplied by the user.

See iprofile for plotting individual profiles from recursive fitted values.


## S3 method for class 'mprofile'
plot(x, nind=1, intensity=FALSE, add=FALSE, ylim=range(z$pred, na.rm = TRUE),
	lty=NULL, ylab=NULL, xlab=NULL, ...)



An object of class mprofile, e.g. x = mprofile(z, times=NULL, mu=NULL, ccov, plotse=TRUE), where zAn object of class recursive, from carma, elliptic, gar, kalcount, kalseries, kalsurv, or nbkal; times is a vector of time points at which profiles are to be plotted; mu is the location regression as a function of the parameters and the times for the desired covariate values; ccov is covariate values for the profiles (carma only); and plotse when TRUE plots standard errors (carma only).


Observation number(s) of individual(s) to be plotted. (Not used if mu is supplied.)


If TRUE, the intensity is plotted instead of the time between events. Only for models produced by kalsurv.


If TRUE, add contour to previous plot instead of creating a new one.


See base plot.


Arguments passed to other functions.


mprofile returns information ready for plotting by plot.mprofile.


J.K. Lindsey

See Also

iprofile, plot.residuals.


## Not run: 
## try after you get the repeated package
times <- rep(1:20,2)
dose <- c(rep(2,20),rep(5,20))
mu <- function(p) exp(p[1]-p[3])*(dose/(exp(p[1])-exp(p[2]))*
shape <- function(p) exp(p[1]-p[2])*times*dose*exp(-exp(p[1])*times)
conc <- matrix(rgamma(40,1,scale=mu(log(c(1,0.3,0.2)))),ncol=20,byrow=TRUE)
conc[,2:20] <- conc[,2:20]+0.5*(conc[,1:19]-matrix(mu(log(c(1,0.3,0.2))),
conc <- ifelse(conc>0,conc,0.01)
z <- gar(conc, dist="gamma", times=1:20, mu=mu, shape=shape,
	preg=log(c(1,0.4,0.1)), pdepend=0.5, pshape=log(c(1,0.2)))
# plot individual profiles and the average profile
plot(iprofile(z), nind=1:2, pch=c(1,20), lty=3:4)
plot(mprofile(z), nind=1:2, lty=1:2, add=TRUE)

## End(Not run)

rmutil documentation built on Oct. 29, 2022, 1:08 a.m.

Related to mprofile in rmutil...