Skip to contents

The degrees of freedom are the DIFFERENCE IN DIMENSION, not the number of parameters in either model. A negative statistic is raised rather than clamped to zero.

Usage

Lrtest(loglik_full, loglik_null, df)

Arguments

loglik_full

Maximised log-likelihood over the whole space.

loglik_null

Maximised log-likelihood over the null subspace.

df

dim(Theta) - dim(Theta_0), at least 1.

Value

List with statistic, p_value, df, loglik_full, loglik_null.

Details

Formula: lambda = 2 (l_full - l_null); p = P(chi^2_df > lambda)

References

Wasserman (2004), All of Statistics, Definition 10.21 and Theorem 10.22, under which lambda converges to chi^2 with r - q degrees of freedom, "the dimension of Theta minus the dimension of Theta_0".

Examples

# nested normal models: the full model frees one mean
Lrtest(loglik_full = -140.2, loglik_null = -143.9, df = 1)
#> $statistic
#> [1] 7.4
#> 
#> $p_value
#> [1] 0.006522388
#> 
#> $df
#> [1] 1
#> 
#> $loglik_full
#> [1] -140.2
#> 
#> $loglik_null
#> [1] -143.9
#> 
#> $method
#> [1] "Likelihood ratio test, Wasserman Theorem 10.22"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"