View source: R/logLik.dglars.R
logLik.dglars | R Documentation |
logLik method for an object with class ‘dglars’.
## S3 method for class 'dglars'
logLik(object, phi = c("pearson", "deviance", "mle", "grcv"),
g = NULL, ...)
object |
any fitted |
phi |
a description of the estimator used to estimate the dispersion pamater (see below for more details). |
g |
vector of values of the tuning parameter. |
... |
further arguments passed to the function |
logLik.dglars
returns the sequence of the log-likelihood values of the models fitted by “dglars
”. For the binomial and Poisson family, the dispersion parameter is assumed known and equal to one while for the other families the dispersion parameter is estimated using the method specified by the argument “phi
” (see phihat
for more details). The optional argument g
is used to specified the values of the tuning parameter; if not specified (default), the log-likelihood values are computed for the sequence of models storage in object
otherwise predict.dglars
is used to compute the estimate of the parameters needed to evaluate the log-likelihood function (see the example below).
logLik.dglars
returns an object of class “loglik_dglars
”. This is a named list containing the following components:
loglik |
the log-likelihood of the sequence of models fitted by dglars method. |
df |
the numbers of non-zero estimates corresponding to the used |
object |
the fitted |
g |
the sequence of |
phi |
a description of the estimator used to estimate the dispersion pamater. |
phih |
the sequence of estimated dispersion parameter. |
Luigi Augugliaro
Maintainer: Luigi Augugliaro luigi.augugliaro@unipa.it
dglars
, phihat
, predict.dglars
, AIC.dglars
and BIC.dglars
.
#################################
# y ~ Poisson
library(dglars)
set.seed(123)
n <- 100
p <- 5
X <- matrix(abs(rnorm(n*p)),n,p)
eta <- 1 + X[, 1] + X[, 2]
mu <- poisson()$linkinv(eta)
y <- rpois(n, mu)
out <- dglars(y ~ X, poisson)
logLik(out)
logLik(out, g = seq(2, 0.5, by = -0.1))
############################
# y ~ Gamma
n <- 100
p <- 5
X <- matrix(abs(rnorm(n*p)),n,p)
eta <- 1 + 2 * X[, 1L]
mu <- drop(Gamma()$linkinv(eta))
shape <- 0.5
phi <- 1 / shape
y <- rgamma(n, scale = mu / shape, shape = shape)
out <- dglars(y ~ X, Gamma("log"))
# generalized Pearson statistic
logLik(out, phi = "pearson")
# deviance estimator
logLik(out, phi = "deviance")
# mle estimator
logLik(out, phi = "mle")
# grcv estimator
logLik(out, phi = "grcv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.