| lm.mle | R Documentation |
lm.mle fits a linear regression model by maximum likelihood, allowing
for optional multiplicative heteroskedasticity in the disturbance variance via
a log-linear specification provided through ln.var.v.
lm.mle(
formula,
data,
subset,
ln.var.v = NULL,
technique = c("bfgs"),
lmtol = 1e-05,
reltol = 1e-12,
maxit = 199,
optim.report = 1,
optim.trace = 10,
print.level = 0,
digits = 4,
only.data = FALSE,
...
)
formula |
an object of class |
data |
an optional |
subset |
an optional logical or numeric vector specifying the subset of observations to be used in estimation. |
ln.var.v |
optional one-sided formula; e.g. |
technique |
character vector specifying the preferred optimization routine(s) in order of
preference. Recognized keywords (for future implementation) include |
lmtol |
numeric. Convergence tolerance based on scaled gradient (when applicable).
Default |
reltol |
numeric. Relative convergence tolerance for likelihood maximization.
Default |
maxit |
integer. Maximum number of iterations for the optimizer. Default |
optim.report |
integer. Verbosity level for reporting progress (if implemented). Default |
optim.trace |
integer. Trace level for optimization (if implemented). Default |
print.level |
integer. Printing level for summaries. Default |
digits |
integer. Number of digits for printing. Default |
only.data |
logical. If |
... |
additional arguments reserved for future methods (e.g., bounds, penalties). |
Linear Model by Maximum Likelihood (with optional heteroskedasticity)
This function fits a maximum-likelihood linear model.
The model is
y_i = x_i^\top \beta + \varepsilon_i,\quad \varepsilon_i \sim \mathcal{N}(0, \sigma_i^2).
When ln.var.v is supplied, the variance follows
\log(\sigma_i^2) = w_i^\top \gamma_v,
otherwise \sigma_i^2 = \sigma^2 is constant (homoskedastic).
This function:
Builds the model frame and X, y.
Builds Zv for the log-variance index when ln.var.v is provided.
Returns a structured object with placeholders for coef, vcov, loglik.
Insert your MLE engine to estimate \beta, and (optionally) \sigma^2 or
\gamma_v; compute standard errors via AIM/OPG as required by vcetype.
A list of class "snreg" containing:
par |
Numeric vector of MLE parameter estimates. |
value |
Maximized log-likelihood. |
ll |
Maximized log-likelihood (alias). |
counts |
Number of function evaluations (from |
convergence |
Convergence code from |
message |
Message returned by |
hessian |
Observed Hessian matrix at optimum. |
coef |
Named coefficient vector; equal to |
vcov |
Variance–covariance matrix |
sds |
Standard errors: |
ctab |
Coefficient table with columns: |
esample |
Logical vector: observations used in estimation. |
n |
Number of observations in estimation sample. |
The object inherits the default
optim components and is assigned class "snreg".
snsf, snreg
library(snreg)
data("banks07")
head(banks07)
# Translog cost function specification
spe.tl <- log(TC) ~ (log(Y1) + log(Y2) + log(W1) + log(W2))^2 +
I(0.5 * log(Y1)^2) + I(0.5 * log(Y2)^2) +
I(0.5 * log(W1)^2) + I(0.5 * log(W2)^2)
# Specification 1: homoskedastic noise (ln.var.v = NULL)
formSV <- NULL # variance equation; constant variance
m1 <- lm.mle(
formula = spe.tl,
data = banks07,
ln.var.v = formSV
)
summary(m1)
# Specification 2: heteroskedastic
formSV <- ~ log(TA) # variance equation; heteroskedastic noise (variance depends on TA)
m2 <- lm.mle(
formula = spe.tl,
data = banks07,
ln.var.v = formSV
)
summary(m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.