termplot                package:base                R Documentation

_P_l_o_t _r_e_g_r_e_s_s_i_o_n _t_e_r_m_s

_D_e_s_c_r_i_p_t_i_o_n:

     Plots regression terms against their predictors, optionally with
     standard errors and partial residuals added.

_U_s_a_g_e:

     termplot(model, data=model.frame(model), partial.resid=FALSE, rug=FALSE,
              terms=NULL, se=FALSE, xlabs=NULL, ylabs=NULL, main = NULL,
              col.term = 2, lwd.term = 1.5,
              col.se = "orange", lty.se = 2, lwd.se = 1,
              col.res = "gray", cex = 1, pch = par("pch"),
              ask = interactive() && nb.fig < n.tms && .Device != "postscript",
              ...)

_A_r_g_u_m_e_n_t_s:

   model: fitted model object

    data: data frame in which the variables in `model' can be found

partial.resid: logical; should partial residuals be plotted?

     rug: add rugplots (jittered 1-d histograms) to the axes?

   terms: which terms to plot (default `NULL' means all terms)

      se: plot pointwise standard errors?

   xlabs: vector of labels for the x axes

   ylabs: vector of labels for the y axes

    main: logical, or vector of main titles;  if `TRUE', the model's
          call is taken as main title, `NULL' or `FALSE' mean no
          titles.

col.term, lwd.term: color and line width for the ``term curve'', see
          `lines'.

col.se, lty.se, lwd.se: color, line type and line width for the
          ``twice-standard-error curve'' when `se = TRUE'.

col.res, cex, pch: color, plotting character expansion and type for
          partial residuals, when `partial.resid = TRUE', see `points'.

     ask: logical; if `TRUE', the user is asked before each plot, see
          `par(ask=.)'.

     ...: other graphical parameters

_D_e_t_a_i_l_s:

     The model object must have a `predict' method that accepts
     `type=terms', eg `glm' in the base package, `coxph' and `survreg'
     in the `survival' package.

     For the `partial.resid=TRUE' option it must have a `residuals'
     method that accepts `type="partial"', which `lm' and `glm' do.

     It is often necessary to specify the `data' argument, because it
     is not possible to reconstruct eg `x' from a model frame
     containing `sin(x)'.  The `data' argument must have exactly the
     same rows as the model frame of the model object so, for example,
     missing data must  have been removed in the same way.

_S_e_e _A_l_s_o:

     For (generalized) linear models, `plot.lm' and `predict.glm'.

_E_x_a_m_p_l_e_s:

     rs <- require(splines)
     x <- 1:100
     z <- factor(rep(1:4,25))
     y <- rnorm(100,sin(x/10)+as.numeric(z))
     model <- glm(y ~ ns(x,6) + z)

     par(mfrow=c(2,2)) ## 2 x 2 plots for same model :
     termplot(model, main = paste("termplot( ", deparse(model$call)," ...)"))
     termplot(model, rug=TRUE)
     termplot(model, partial=TRUE, rug= TRUE,
              main="termplot(..., partial = TRUE, rug = TRUE)")
     termplot(model, partial=TRUE, se = TRUE, main = TRUE)
     if(rs) detach("package:splines")

