gldrmLRT: Likelihood ratio test for nested models

View source: R/gldrmLRT.R

gldrmLRTR Documentation

Likelihood ratio test for nested models

Description

Performs a likelihood ratio F-test between nested gldrm models. The F-statistic is calculated as 2 \times (llik - llik_0) / r, where r is the difference is the number of parameters between the full and null models. The F-statistic has degrees of freedom r and n-p, where n is the number of observations and p is the number of parameters in the full model.

Usage

gldrmLRT(gldrmFit, gldrmNull)

Arguments

gldrmFit

The full model. Must be an object of S3 class 'gldrm' returned from the gldrm function.

gldrmNull

The sub-model being tested under the null hypotheses. Must be an object of S3 class 'gldrm' returned from the gldrm function.

Value

An S3 object of class 'gldrmLRT', containing numerator and denominator degrees of freedom, an F-statistic, and a p-value.

Examples

data(iris, package="datasets")

### Fit gldrm with all variables
fit <- gldrm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species,
             data=iris, link="log")

### Fit gldrm without the categorical variable "Species"
fit0 <- gldrm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width,
              data=iris, link="log")

### Likelihood ratio test for the nested models
lrt <- gldrmLRT(fit, fit0)
lrt


gldrm documentation built on May 29, 2024, 4:28 a.m.

Related to gldrmLRT in gldrm...