lr_test {stagedtrees} | R Documentation |
Likelihood Ratio Test for staged trees models
Description
Function to perform likelihood ratio test between two or multiple staged event tree models.
Usage
lr_test(object, ...)
Arguments
object |
an object of class |
... |
further objects of class |
Details
If a single object of class sevt
is passed as
argument, it computes
the likelihood-ratio test with respect to the
independence model.
If multiple objects are passed,
likelihood-ratio tests between the first
object and the followings are computed.
In the latter case the function checks automatically if
the first model is nested in the additional ones,
via inclusions_stages
, and throws
an error if not.
Value
An object of class anova
which contains the log-likelihood,
degrees of freedom,
difference in degrees of freedom, likelihood ratio
statistics and corresponding p values.
Examples
data(PhDArticles)
order <- c("Gender", "Kids", "Married", "Articles")
phd.mod1 <- stages_hc(indep(PhDArticles, order))
phd.mod2 <- stages_hc(full(PhDArticles, order))
## compare two nested models
lr_test(phd.mod1, phd.mod2)
## compare a single model vs the independence model
lr_test(phd.mod1)