| gldrm {gldrm} | R Documentation |
Fits a generalized linear density ratio model (GLDRM)
Description
A GLDRM is a semiparametric generalized linear model. In contrast to a GLM, which assumes a particular exponential family distribution, the GLDRM uses a semiparametric likelihood to estimate the reference distribution. The reference distribution may be any discrete, continuous, or mixed exponential family distribution. The model parameters, which include both the regression coefficients and the cdf of the unspecified reference distribution, are estimated by maximizing a semiparametric likelihood. Regression coefficients are estimated with no loss of efficiency, i.e. the asymptotic variance is the same as if the true exponential family distribution were known.
Usage
gldrm(
formula,
data = NULL,
link = "identity",
mu0 = NULL,
offset = NULL,
gldrmControl = gldrm.control(),
thetaControl = theta.control(),
betaControl = beta.control(),
f0Control = f0.control()
)
Arguments
formula |
An object of class "formula". |
data |
An optional data frame containing the variables in the model. |
link |
Link function. Can be a character string to be passed to the
|
mu0 |
Mean of the reference distribution. The reference distribution is
not unique unless its mean is restricted to a specific value. This value can
be any number within the range of observed values, but values near the boundary
may cause numerical instability. This is an optional argument with |
offset |
Known component of the linear term. Offset must be passed through
this argument - offset terms in the formula will be ignored.
value and covariate values. If sampling weights are a function of both the
response value and covariates, then |
gldrmControl |
Optional control arguments.
Passed as an object of class "gldrmControl", which is constructed by the
|
thetaControl |
Optional control arguments for the theta update procedure.
Passed as an object of class "thetaControl", which is constructed by the
|
betaControl |
Optional control arguments for the beta update procedure.
Passed as an object of class "betaControl", which is constructed by the
|
f0Control |
Optional control arguments for the |
Details
The arguments linkfun, linkinv, and mu.eta
mirror the "link-glm" class. Objects of this class can be created with the
stats::make.link function.
The "gldrm" class is a list of the following items.
-
convLogical indicator for whether the gldrm algorithm converged within the iteration limit. -
iterNumber of iterations used. A single iteration is abetaupdate, followed by anf0update. -
llikSemiparametric log-likelihood of the fitted model. -
betaVector containing the regression coefficient estimates. -
muVector containing the estimated mean response value for each observation in the training data. -
etaVector containing the estimated linear combination of covariates for each observation. -
f0Vector containing the semiparametric estimate of the reference distribution, evaluated at the observed response values. The values of correspond to the support values, sorted in increasing order. -
sptVector containing the unique observed response values, sorted in increasing order. -
mu0Mean of the estimated semiparametric reference distribution. The mean of the reference distribution must be fixed at a value in order for the model to be identifiable. It can be fixed at any value within the range of observed response values, but thegldrmfunction assignsmu0to be the mean of the observed response values. -
varbetaEstimated variance matrix of the regression coefficients. -
seBetaStandard errors for\hat{\beta}. Equal tosqrt(diag(varbeta)). -
seMuStandard errors for\hat{\mu}computed fromvarbeta. -
seEtaStandard errors for\hat{\eta}computed fromvarbeta. -
thetaVector containing the estimated tilt parameter for each observation. The tilted density function of the response variable is given byf(y|x_i) = f_0(y) \exp(\theta_i y) / \int f_0(u) \exp(\theta_i u) du. -
bPrimeis a vector containing the mean of the tilted distribution,b'(\theta_i), for each observation.bPrimeshould matchmu, except in cases wherethetais capped for numerical stability.b'(\theta_i) = \int u f(u|x_i) du -
bPrime2is a vector containing the variance of the tilted distribution,b''(\theta_i), for each observation.b''(\theta_i) = \int (u - b'(\theta_i))^2 f(u|x_i) du -
fTiltis a vector containing the semiparametric fitted probability,\hat{f}(y_i | x_i), for each observation. The semiparametric log-likelihood is equal to\sum_{i=1}^n \log \hat{f}(y_i | x_i). -
sampprobsIf sampling probabilities were passed through thesampprobsargument, then they are returned here in matrix form. Each row corresponds to an observation. -
llikNullLog-likelihood of the null model with no covariates. -
lr.statLikelihood ratio test statistic comparing fitted model to the null model. It is calculated as2 \times (llik - llik_0) / (p-1). The asymptotic distribution is F(p-1, n-p) under the null hypothesis. -
lr.pvalP-value of the likelihood ratio statistic. -
fTiltMatrixis a matrix containing the semiparametric density for each observation, i.e.\hat{f}(y | x_i)for each uniqueyvalue. This is a matrix with nrow equal to the number of observations and ncol equal to the number of unique response values observed. Only returned ifreturnfTilt = TRUEin the gldrmControl arguments. -
score.logf0Score function forlog(f0). Only returned ifreturnf0ScoreInfo = TRUEin the gldrmControl arguments. -
info.logf0Information matrix forlog(f0). Only returned ifreturnf0ScoreInfo = TRUEin the gldrmControl arguments. -
formulaModel formula. -
dataModel data frame. -
linkLink function. If a character string was passed to thelinkargument, then this will be an object of class "link-glm". Otherwise, it will be the list of three functions passed to thelinkargument.
Value
An S3 object of class "gldrm". See details.
Examples
data(iris, package="datasets")
# Fit a gldrm with log link
fit <- gldrm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species,
data=iris, link="log")
fit
# Fit a gldrm with custom link function
link <- list()
link$linkfun <- function(mu) log(mu)^3
link$linkinv <- function(eta) exp(eta^(1/3))
link$mu.eta <- function(eta) exp(eta^(1/3)) * 1/3 * eta^(-2/3)
fit2 <- gldrm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species,
data=iris, link=link)
fit2