lr_test {CircMLE}R Documentation

Likelihood ratio test for nested models

Description

Statistically test nested models for the rejection of the null model in favor of the alternative model.

Usage

lr_test(data, null_model, alt_model)

Arguments

data

A vector of class 'circular'

null_model

character string indicating the null model to be used. Must be one of c("M1", "M2A", "M2B", "M2C", "M3A", "M3B", "M4A", "M4B", "M5A", "M5B").

alt_model

character string indicating the alternative model to be used. Must be one of c("M1", "M2A", "M2B", "M2C", "M3A", "M3B", "M4A", "M4B", "M5A", "M5B").

Value

A list with elements:

$null_model: Vector with the model name and number of free parameters

$alt_model: Vector with the model name and number of free parameters

$lr: likelihood ratio test statistic 2 * (-log(L1) - -log(L2))

$df: degrees of freedom (difference in number of parameters between models)

$p_val: probability of rejecting null model in favor of alternative model due to chance (e.g, if <0.05, data favors alternative model).

Examples

testdata = circular::rvonmises(100, mu = circular::circular(pi), kappa = 3)
lr_test(testdata, "M1", "M2A")

[Package CircMLE version 0.3.0 Index]