lr_test: Likelihood Ratio Test for staged trees models

View source: R/3-inference-functions.R

lr_testR 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 sevt.

...

further objects of class sevt. Must specify super-models of object. See below for details.

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 casem 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)

stagedtrees documentation built on April 29, 2022, 1:06 a.m.