Learn R Programming

sdlrm (version 0.1.2)

sdlrm-methods: Extract Information From a Modified Skew Discrete Laplace Regression Fit

Description

Additional methods for "sdlrm" objects.

Usage

# S3 method for sdlrm
model.frame(formula, ...)

# S3 method for sdlrm model.matrix(object, parm = c("mean", "dispersion"), ...)

# S3 method for sdlrm coef(object, parm = c("mean", "dispersion", "full"), ...)

# S3 method for sdlrm vcov(object, parm = c("mean", "dispersion", "full"), ...)

# S3 method for sdlrm logLik(object, ...)

# S3 method for sdlrm AIC(object, ..., k = 2)

Value

  • model.frame returns a data.frame containing the variables required by formula and any additional arguments provided via ....

  • model.matrix returns the design matrix used in the regression structure, as specified by the parm argument.

  • coef returns a numeric vector of estimated regression coefficients, based on the parm argument. If parm = "full", it returns a list with the components "mean" and "dispersion", each containing the corresponding coefficient estimates.

  • vcov returns the asymptotic covariance matrix of the regression coefficients, based on the parm argument.

  • logLik returns the log-likelihood value of the fitted model.

  • AIC returns a numeric value representing the Akaike Information Criterion (AIC), Bayesian Information Criterion, or another criterion, depending on k.

Arguments

formula

a model formula or terms object or an "sdlrm" object.

...

further arguments passed to or from other methods.

object

an object of class "sdlrm", a result of a call to sdlrm.

parm

a character indicating which group of parameters is to be considered in the function. The options are "mean" (default) to obtain the output in relation to the coefficients associated with the mean, "dispersion" to obtain the output in relation to the coefficients associated with the dispersion, or "full" (when applicable) to consider all the parameters,

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

Author

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

Examples

Run this code
# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

# Fit a double model (mode = 1)
fit <- sdlrm(difference ~ group | group, data = pss, xi = 1)

# Coef
coef(fit)
coef(fit, parm = "dispersion")
coef(fit, parm = "full")

# vcov
vcov(fit)
vcov(fit, parm = "dispersion")
vcov(fit, parm = "full")

# Log-likelihood value
logLik(fit)

# AIC and BIC
AIC(fit)
AIC(fit, k = log(fit$nobs))

# Model matrices
model.matrix(fit)
model.matrix(fit, "dispersion")

Run the code above in your browser using DataLab