Maximum likelihood estimation of the degrees of freedom for a chi-squared distribution. Also fits the chi distribution.

chisq(link = "loglink", zero = NULL, squared = TRUE)

Arguments

See CommonVGAMffArguments for information.

squared

Logical. Set FALSE for the chi distribution.

Details

The degrees of freedom is treated as a real parameter to be estimated and not as an integer. Being positive, a log link is used by default. Fisher scoring is used.

If a random variable has a chi-squared distribution then the square root of the random variable has a chi distribution. For both distributions, the fitted value is the mean.

Value

An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm, and vgam.

References

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2011). Statistical Distributions, Hoboken, NJ, USA: John Wiley and Sons, Fourth edition.

Author

T. W. Yee

Note

Multiple responses are permitted. There may be convergence problems if the degrees of freedom is very large or close to zero.

See also

Examples

cdata <- data.frame(x2 = runif(nn <- 1000))
cdata <- transform(cdata, y1 = rchisq(nn, df = exp(1 - 1 * x2)),
                          y2 = rchisq(nn, df = exp(2 - 2 * x2)))
fit <- vglm(cbind(y1, y2) ~ x2, chisq, data = cdata, trace = TRUE)
#> Iteration 1: loglikelihood = -3440.3393
#> Iteration 2: loglikelihood = -3309.0745
#> Iteration 3: loglikelihood = -3308.7326
#> Iteration 4: loglikelihood = -3308.7323
#> Iteration 5: loglikelihood = -3308.7323
coef(fit, matrix = TRUE)
#>             loglink(df1) loglink(df2)
#> (Intercept)     1.022617     1.964611
#> x2             -1.082471    -1.950279