| Library: | glm |
| See also: | glmest glmstat glmll |
| Macro: | glmlrtest | |
| Description: | glmlrtest performs a likelihood ratio test of two nested GLM. |
| Usage: | {lr,alpha} = glmlrtest(loglik0,dim0,loglik1,dim1) | |
| Input: | ||
| loglik0 | scalar, log-likelihood of the hypothesis model. | |
| dim0 | integer, dimension of the hypothesis model. | |
| loglik1 | scalar, log-likelihood of the alternative model, loglik1 >= loglik0. | |
| dim1 | integer, dimension of the hypothesis model, dim1 >= dim0. | |
| Output: | ||
| lr | scalar, value of the lr test statistic. | |
| alpha | scalar, significance level at which hypothesis is rejected. | |
library("glm")
n = 100
x = normal(n)
eps= normal(n)
y = x/3+eps
one =matrix(n)
mod0=glmest("noid",one,y) ; constant regression
mod1=glmest("noid",one~x,y) ; linear regression
{lr,alpha}=glmlrtest(mod0.stat.loglik,1,mod1.stat.loglik,2)
alpha
The significance level (smallest level) at which the constant regression model is rejected.
| Library: | glm |
| See also: | glmest glmstat glmll |