Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

logLik-grpreg

logLik method for grpreg


Description

Calculates the log likelihood and degrees of freedom for a fitted grpreg object.

Usage

## S3 method for class 'grpreg'
logLik(object, df.method=c("default","active"),
REML=FALSE, ...)

Arguments

object

A fitted grpreg object.

df.method

How should effective model parameters be calculated? One of: "active", which counts the number of nonzero coefficients; or "default", which uses the calculated df returned by grpreg. Default is "default".

REML

Use restricted MLE for estimation of the scale parameter in a gaussian model? Default is FALSE.

...

For S3 method compatibility.

Details

Exists mainly for use with 'AIC' and 'BIC'.

Value

Returns an object of class 'logLik', in this case consisting of a number (or vector of numbers) with two attributes: 'df' (the estimated degrees of freedom in the model) and 'nobs' (number of observations).

The 'print' method for 'logLik' objects is not intended to handle vectors; consequently, the value of the function does not necessarily display correctly. However, it works with 'AIC' and 'BIC' without any glitches and returns the expected vectorized output.

Author(s)

Patrick Breheny

See Also

grpreg

Examples

data(Birthwt)
X <- Birthwt$X
y <- Birthwt$bwt
group <- Birthwt$group
fit <- grpreg(X,y,group,penalty="cMCP")
logLik(fit) ## Display is glitchy for vectors
AIC(fit)
BIC(fit)

grpreg

Regularization Paths for Regression Models with Grouped Covariates

v3.3.1
GPL-3
Authors
Patrick Breheny [aut, cre] (<https://orcid.org/0000-0002-0650-1119>), Yaohui Zeng [ctb]
Initial release
2021-03-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.