Description Usage Arguments Details Value Methods (by generic) See Also Examples
Fit tree models based on the Dirichlet distribution.
1 2 3 4 5 6 7 |
formula |
A symbolic description of the model to be fit. This should either be of type 'y1 + y2 + y3 ~ x1 + x2' with reponse vectors 'y1', 'y2', and 'y3' or 'y ~ x1 + x2' with a matrix response 'y'. 'x1' and 'x2' are used as partitioning variables. |
data |
A data frame containing the variables in the model. |
na.action |
A function which indicates what should happen when the data contain missing values 'NA'. |
... |
arguments passed to [partykit::mob_control()], [partykit::print.modelparty()] and [partykit::plot.modelparty()]. |
x |
An object of class 'proptree'. |
title |
character, title for print method. |
objfun |
character, labeling objective function. |
proportions |
logical, display proportions (default) or log-alphas of Dirichlet distribution. |
Fit tree models on proportional or compositional data based on the Dirichlet distribution. This funciton is a high-level interface to 'partykit::mob()' in combination with the fitter 'propfit()'.
An object of class 'proptree' inheriting from 'modelparty'.
print: print method
plot: plot method
[partykit::mob()], [propfit()]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ### --- toy data ---
set.seed(111)
n <- 500
x <- sample(c(-1, 1), n, replace = TRUE)
alpha <- cbind(
rnorm(n, 1.4, sd = .1),
rnorm(n, 1.4, sd = .1),
jitter(2 + x)
)
y <- alpha / rowSums(alpha)
d <- as.data.frame(y)
names(d) <- paste0("y", 1:3)
d$x <- jitter(x)
tr <- proptree(y1 + y2 + y3 ~ x, data = d)
plot(tr)
### --- Sediment composition ---
data("ArcticLake", package = "DirichletReg")
tr <- proptree(sand + silt + clay ~ depth, data = ArcticLake)
plot(tr)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.