mprofile               package:rmutil               R Documentation

_P_r_o_d_u_c_e _M_a_r_g_i_n_a_l _T_i_m_e _P_r_o_f_i_l_e_s _f_o_r _P_l_o_t_t_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

     '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.

_U_s_a_g_e:

     zz <- mprofile(z, times=NULL, mu=NULL, ccov, plotse=TRUE)
     plot(zz, nind=1, intensity=FALSE, add=FALSE, ylim=c(min(z$pred),max(z$pred)),
             lty=NULL, ylab="Fitted value", xlab="Time", ...)

_A_r_g_u_m_e_n_t_s:

       z: An object of class 'recursive', from 'carma', 'elliptic',
          'gar', 'kalcount', 'kalseries', 'kalsurv', or 'nbkal'.

      zz: An object of class 'mprofile'/

   times: Vector of time points at which profiles are to be plotted.

      mu: The location regression as a function of the parameters and
          the times for the desired covariate values.

    ccov: Covariate values for the profiles ('carma' only).

  plotse: If TRUE, plot standard errors ('carma' only).

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

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

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

  others: Plotting control options.

_V_a_l_u_e:

     'mprofile'  returns information ready for plotting by
     'plot.mprofile'.

_A_u_t_h_o_r(_s):

     J.K. Lindsey

_S_e_e _A_l_s_o:

     'carma', 'elliptic', 'gar', 'kalcount', 'kalseries', 'kalsurv',
     'nbkal' 'iprofile', 'plot.residuals'.

_E_x_a_m_p_l_e_s:

     library(repeated)
     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]))*
             (exp(-exp(p[2])*times)-exp(-exp(p[1])*times)))
     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))),
             ncol=20,byrow=TRUE)[,1:19])
     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)

