Description Usage Arguments Details Value References Examples

A proof-of-concept implementation of multivariate conditional transformation models for count data.

1 2 3 |

`...` |
marginal count transformation models, one for each response |

`formula` |
a model formula describing a model for the dependency
structure via the lambda parameters. The default is set to |

`data` |
a data.frame |

`theta` |
an optional vector of starting values |

`control.outer` |
a list controlling |

`tol` |
tolerance |

`dofit` |
logical; parameters are fitted by default, otherwise a list with log-likelihood and score function is returned |

The function implements multivariate count conditional transformation models. The response is assumed to be a vector of counts.

An object of class `mcotram`

and `mmlt`

with `coef`

and
`predict`

methods.

Luisa Barbani, Roland Brandl, Torsten Hothorn (2021), Multi-species Count Transformation Models. Submitted manuscript, available from the authors.

Nadja Klein, Torsten Hothorn, Luisa Barbanti, Thomas Kneib (2020),
Multivariate Conditional Transformation Models. *Scandinavian Journal
of Statistics*, doi: 10.1111/sjos.12501.

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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ```
op <- options(digits = 2)
data("spiders", package = "cotram")
## fit conditional marginal count transformation models
m_PF <- cotram(Pardosa_ferruginea ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
m_HL <- cotram(Harpactea_lepida ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
m_CC <- cotram(Callobius_claustrarius ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
m_CT <- cotram(Coelotes_terrestris ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
m_PL <- cotram(Pardosa_lugubris ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
m_PR <- cotram(Pardosa_riparia ~ Elevation + Canopy_openess,
data = spiders, method = "probit")
## fit multi-species count transformation model
## with constant Cholesky factor of the precision matrix
##
## define starting values here (this is not necessary but leads
## to diffs for ATLAS and OpenBlas)
theta <- round(c(coef(as.mlt(m_PF)), coef(as.mlt(m_HL)),
coef(as.mlt(m_CC)), coef(as.mlt(m_CT)),
coef(as.mlt(m_PL)), coef(as.mlt(m_PR)),
rep(0, 15)), 2)
m_all_1 <- mcotram(m_PF, m_HL, m_CC, m_CT, m_PL, m_PR,
theta = theta, ### <- not really necessary
formula = ~ 1, data = spiders)
## with covariate-dependent Cholesky factor of the precision matrix
theta <- round(c(coef(as.mlt(m_PF)), coef(as.mlt(m_HL)),
coef(as.mlt(m_CC)), coef(as.mlt(m_CT)),
coef(as.mlt(m_PL)), coef(as.mlt(m_PR)),
rep(0, 15 * 3)), 2)
m_all_2 <- mcotram(m_PF, m_HL, m_CC, m_CT, m_PL, m_PR, theta = theta,
formula = ~ Elevation + Canopy_openess, data = spiders,
## not needed!
control.outer = list(method = "Nelder-Mead", trace = FALSE))
## IGNORE_RDIFF_BEGIN
logLik(m_all_1)
logLik(m_all_2)
## lambda defining the Cholesky factor of the precision matrix
coef(m_all_1, newdata = spiders[1,], type = "Lambda")
coef(m_all_2, newdata = spiders[1,], type = "Lambda")
## linear correlation, ie Pearson correlation of the models after
## transformation to bivariate normality
(r1 <- coef(m_all_1, newdata = spiders[1,], type = "Corr"))
(r2 <- coef(m_all_2, newdata = spiders[1,], type = "Corr"))
## IGNORE_RDIFF_END
options(op)
``` |

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.