R: Plot method for an etm object

plot.etm {etm} | R Documentation

## Plot method for an etm object

### Description

Plot method for an object of class 'etm'. It draws the estimated transition probabilities in a basic scatterplot.

### Usage

    ## S3 method for class 'etm'
    plot(x, tr.choice, xlab = "Time",
         ylab = "Transition Probability", col = 1, lty, xlim, ylim,
         conf.int = FALSE, level = 0.95, ci.fun = "linear",
         ci.col = col, ci.lty = 3,
         legend = TRUE, legend.pos, curvlab, legend.bty = "n", ...)

### Arguments

`x` | An object of class 'etm'
`tr.choice` | character vector of the form 'c("from to","from to")' specifying which transitions should be plotted. Default, all the transition probabilities are plotted
`xlab` | x-axis label. Default is "Time"
`ylab` | y-axis label. Default is "Transition Probability"
`col` | Vector of colour. Default is black
`lty` | Vector of line type. Default is 1:number of transitions
`xlim` | Limits of x-axis for the plot
`ylim` | Limits of y-axis for the plot
`conf.int` | Logical. Whether to display pointwise confidence intervals. Default is FALSE.
`level` | Level of the conficence intervals. Default is 0.95.
`ci.fun` | Transformation applied to the confidence intervals. It could be different for all transition probabilities, though if `length(ci.fun) != number of transitions`, only `ci.fun[1]` will be used. Possible choices are "linear", "log", "log-log" and "cloglog". Default is "linear".
`ci.col` | Colour of the confidence intervals. Default is `col`.
`ci.lty` | Line type of the confidence intervals. Default is 3.
`legend` | A logical specifying if a legend should be added
`legend.pos` | A vector giving the legend's position. See `legend` for further details
`curvlab` | A character or expression vector to appear in the legend. Default is the name of the transitions
`legend.bty` | Box type for the legend
`...` | Further arguments for plot

### Details

By default, if the argument `strata` was used for creating the `etm` object, the first transition probability for all strata will be plotted. If there is no strata, all transition probabilities are plotted by default.

In any case, a legend with be created by the labels are likely to be ugly. Please use the `curvlab` argument to control the test or use `legend = FALSE` and build your own legend.

### Value

No value returned

### Author(s)

Arthur Allignol, arthur.allignol@gmail.com

### See Also

`plot.default`, `legend`, `etm`

### Examples

    data(sir.cont)

    # Modification for patients entering and leaving a state
    # at the same date
    sir.cont <- sir.cont[order(sir.cont$id, sir.cont$time), ]
    for (i in 2:nrow(sir.cont)) {
      if (sir.cont$id[i]==sir.cont$id[i-1]) {
        if (sir.cont$time[i]==sir.cont$time[i-1]) {
          sir.cont$time[i-1] <- sir.cont$time[i-1] - 0.5
        }
      }
    }

    tra <- matrix(ncol=3,nrow=3,FALSE)
    tra[1, 2:3] <- TRUE
    tra[2, c(1, 3)] <- TRUE

    my.etm <- etm(sir.cont,c("0","1","2"),tra,"cens", s = 0)

    plot(my.etm, tr.choice = c("0 0"))

[Package etm version 1.1 Index]