# Comparing nested regression models
# Null model: y ~ x1 (log-likelihood = -150)
# Alt model: y ~ x1 + x2 + x3 (log-likelihood = -140)
# Difference: 3 additional parameters
test <- lrt(null_loglik = -150, alt_loglik = -140, dof = 3)
test
# Is the more complex model significantly better?
is_significant_at(test, 0.05)
# Extract the test statistic (should be 20)
test_stat(test)
# Access stored inputs for inspection
test$null_loglik
test$alt_loglik
Run the code above in your browser using DataLab