Description Usage Arguments Details See Also Examples

Methods for objects inheriting from class cotram

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## S3 method for class 'cotram'
predict(object, newdata = model.frame(object),
type = c("lp", "trafo", "distribution", "survivor", "density",
"logdensity", "hazard", "loghazard", "cumhazard",
"logcumhazard", "odds", "logodds", "quantile"),
smooth = FALSE, q = NULL, K = 20, prob = 1:(10-1)/10, ...)
## S3 method for class 'cotram'
plot(x, newdata, type = c("distribution", "survivor","density",
"logdensity", "cumhazard", "quantile", "trafo"),
confidence = c("none", "band"), level = 0.95,
smooth = FALSE, q = NULL, K = 20, cheat = K, prob = 1:(10-1)/10,
col = "black", fill = "lightgrey",
lty = 1, lwd = 1, add = FALSE, ...)
## S3 method for class 'cotram'
as.mlt(object)
## S3 method for class 'cotram'
logLik(object, parm = coef(as.mlt(object), fixed = FALSE), newdata, ...)
``` |

`object, x` |
a fitted linear count transformation model inheriting
from class |

`newdata` |
an optional data frame of observations. |

`parm` |
model parameters. |

`type` |
type of prediction, current options include
linear predictors ( |

`confidence` |
whether to plot a confidence band (see |

`level` |
the confidence level. |

`smooth` |
logical; if |

`q` |
quantiles at which to evaluate the model. |

`prob` |
probabilities for the evaluation of the quantile function |

`K` |
number of grid points the function is evaluated at
(for |

`cheat` |
number of grid points the function is evaluated at when
using the quantile obtained for |

`col` |
color for the lines to plot. |

`fill` |
color for the confidence band. |

`lty` |
line type for the lines to plot. |

`lwd` |
line width. |

`add` |
logical; indicating if a new plot shall be generated (the default). |

`...` |
additional arguments to the underlying methods for |

`predict`

and `plot`

can be used to inspect the model on
different scales.

`predict.cotram`

, `confband.cotram`

,
`tram-methods`

, `mlt-methods`

, `plot.ctm`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
data("birds", package = "TH.data")
### fit count transformation model with cloglog link
m_birds <- cotram(SG5 ~ AOT + AFS + GST + DBH + DWC + LOG, data = birds,
method = "cloglog")
logLik(m_birds)
### classical likelihood inference
## IGNORE_RDIFF_BEGIN
summary(m_birds)
## IGNORE_RDIFF_END
### coefficients of the linear predictor (discrete hazard ratios)
exp(-coef(m_birds))
### compute predicted median along with 10% and 90% quantile for the first
### three observations
nd <- birds[1:3,]
predict(m_birds, newdata = nd, type = "quantile", prob = c(.1, .5, .9),
smooth = TRUE)
### plot the predicted distribution for these observations
plot(m_birds, newdata = nd, type = "distribution",
col = c("skyblue", "grey", "seagreen"))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.