Returns the number of parameters in a fitted model object.

nparam(object, ...)
    nparam.vlm(object, dpar = TRUE, ...)
   nparam.vgam(object, dpar = TRUE, linear.only = FALSE, ...)
 nparam.rrvglm(object, dpar = TRUE, ...)
nparam.drrvglm(object, dpar = TRUE, ...)
nparam.qrrvglm(object, dpar = TRUE, ...)
 nparam.rrvgam(object, dpar = TRUE, ...)

Arguments

object

Some VGAM object, for example, having class vglmff-class.

...

Other possible arguments fed into the function.

dpar

Logical, include any (estimated) dispersion parameters as a parameter?

linear.only

Logical, include only the number of linear (parametric) parameters?

Details

The code was copied from the AIC() methods functions.

Value

Returns a numeric value with the corresponding number of parameters. For vgam objects, this may be real rather than integer, because the nonlinear degrees of freedom is real-valued.

Author

T. W. Yee.

Warning

This code has not been double-checked.

See also

VGLMs are described in vglm-class; VGAMs are described in vgam-class; RR-VGLMs are described in rrvglm-class; AICvlm.

Examples

pneumo <- transform(pneumo, let = log(exposure.time))
(fit1 <- vglm(cbind(normal, mild, severe) ~ let, propodds, data = pneumo))
#> 
#> Call:
#> vglm(formula = cbind(normal, mild, severe) ~ let, family = propodds, 
#>     data = pneumo)
#> 
#> 
#> Coefficients:
#> (Intercept):1 (Intercept):2           let 
#>     -9.676093    -10.581725      2.596807 
#> 
#> Degrees of Freedom: 16 Total; 13 Residual
#> Residual deviance: 5.026826 
#> Log-likelihood: -25.09026 
coef(fit1)
#> (Intercept):1 (Intercept):2           let 
#>     -9.676093    -10.581725      2.596807 
coef(fit1, matrix = TRUE)
#>             logitlink(P[Y>=2]) logitlink(P[Y>=3])
#> (Intercept)          -9.676093         -10.581725
#> let                   2.596807           2.596807
nparam(fit1)
#> [1] 3
(fit2 <- vglm(hits ~ 1, poissonff, weights = ofreq, data = V1))
#> 
#> Call:
#> vglm(formula = hits ~ 1, family = poissonff, data = V1, weights = ofreq)
#> 
#> 
#> Coefficients:
#> (Intercept) 
#> -0.07010957 
#> 
#> Degrees of Freedom: 6 Total; 5 Residual
#> Residual deviance: 668.7322 
#> Log-likelihood: -732.5946 
coef(fit2)
#> (Intercept) 
#> -0.07010957 
coef(fit2, matrix = TRUE)
#>             loglink(lambda)
#> (Intercept)     -0.07010957
nparam(fit2)
#> [1] 1
nparam(fit2, dpar = FALSE)
#> [1] 1