orlm {ic.infer} | R Documentation |
Functions for order restricted linear regression estimation and testing
Description
Function orlm calculates order-restricted linear models (linear equality and inequality constraints). It uses the internal function boot.orlm for bootstrapping, which in turn uses the internal functions orlm_forboot... . The remaining functions extract coefficients, provide a residual plot, give a short printout or a more extensive summary.
Usage
orlm(model, ui, ci, ...)
## S3 method for class 'lm'
orlm(model, ui, ci, index = 2:length(coef(model)), meq = 0,
orig.out = FALSE, boot = FALSE, B = 1000, fixed = FALSE,
tol = sqrt(.Machine$double.eps), ...)
## Default S3 method:
orlm(model, ui, ci, index = NULL, meq = 0,
tol = sqrt(.Machine$double.eps), df.error = NULL, ...)
boot.orlm(model, B = 1000, fixed = FALSE, ui, ci, index, meq)
orlm_forboot.fixed(data, indices, ...)
orlm_forboot(data, indices, index = index, ...)
## S3 method for class 'orlm'
coef(object, ...)
## S3 method for class 'orlm'
plot(x, caption = "Residuals vs Fitted",
panel = if (add.smooth) panel.smooth else points, sub.caption = NULL,
main = "", ..., id.n = 3, labels.id = names(x$residuals), cex.id = 0.75,
add.smooth = getOption("add.smooth"), label.pos = c(4, 2),
cex.caption = 1)
## S3 method for class 'orlm'
print(x, digits = max(3, getOption("digits") - 3), ...)
## S3 method for class 'orlm'
summary(object, display.unrestr = FALSE, brief = FALSE,
digits = max(3, getOption("digits") - 3),
scientific = FALSE, overall.tests = TRUE,
bootCIs = TRUE, bty = "perc", level = 0.95, ...)
Arguments
model |
a linear model object (class OR a covariance matrix of Y and all regressors (in this order) |
ui |
matrix (or vector in case of one single restriction only) defining the left-hand side of the restriction
where beta is the parameter vector;
the first few of these restrictions can be declared equality- instead
of inequality restrictions (cf. argument Rows of See |
ci |
vector on the right-hand side of the restriction (cf. |
index |
index numbers of the components of beta,
which are subject to the specified constraints
as CAUTIONs: - - If the intercept is included into restrictions (model with intercept,
index containing the element |
meq |
integer number (default 0) giving the number of rows of |
orig.out |
should the original model be included in the output list ?
(default: |
boot |
should bootstrapping be conducted ? (default: |
B |
number of bootstrap samples (default: |
fixed |
should bootstrapping consider the sample as fixed and bootstrap
residuals ? (default: |
data |
data handed to bootstrap sampling routine |
indices |
indices for sampling |
tol |
numerical tolerance value;
estimates closer to 0 than |
df.error |
error degrees of freedom (number of observations minus
number of colummns of covariance matrix) for |
... |
Further options |
object |
object of class |
x |
object of class |
caption |
like in function |
panel |
like in function |
sub.caption |
like in function |
main |
like in function |
id.n |
like in function |
labels.id |
like in function |
cex.id |
like in function |
add.smooth |
like in function |
label.pos |
like in function |
cex.caption |
like in function |
digits |
number of digits to display |
display.unrestr |
if |
brief |
if |
scientific |
if |
overall.tests |
if |
bootCIs |
if |
bty |
type of bootstrap confidence interval; any of
|
level |
confidence level for bootstrap confidence intervals,
default: |
Details
Function orlm
performs order restricted linear model analysis.
Functions coef.orlm
, plot.orlm
, print.orlm
, and
summary.orlm
provide methods for reporting the results on an object
of S3 class orlm. The functions directly referring to bootstrapping are internal
and should not be called by the user but are called from within function orlm
if option boot
is set to TRUE
.
Of course, bootstrapping is not possible, if function orlm
is applied
to a covariance matrix, since the raw data are not available in this case. Also
note that the intercept is not estimated in this case but can easily be estimated
from the resulting estimate if the variable means are known (cf. example).
The output from summary.orlm provides information about the restrictions, a comparison of $R^2$-values for unrestricted and restricted model, restricted estimates, and
- if requested (option boot
set to TRUE
in function orlm
and
option bootCIs
set to TRUE
in the summary function)
with bootstrap confidence intervals,
- if requested (option overall.tests
set to TRUE
)
several restriction-related tests (implemented by calls to ic.test
):
The analogue to the overall F-Test in the ordinary linear model is the test of
all coefficients but intercept equal to 0 within the restricted parameter
space. In addition, three tests related to the restriction are reported:
Test 1: H0: Restriction valid with equality vs. H1: at least one inequality
Test 2: H0: Restriction valid vs. H1: restriction violated
Test 3: H0: Restriction violated or valid with equality vs. H1: all restrictions valid with inequality
Test 3 is conducted in case of no equality-restrictions only.
Value
The output of function orlm
belongs to S3 classes orlm
and orest
.
It is a list with the following items:
b.restr |
restricted estimate |
b.unrestr |
unrestricted estimate |
R2 |
R-squared |
residuals |
residuals of restricted model |
fitted.values |
fitted values of restricted model |
weights |
observation weights |
orig.R2 |
R-squared of unrestricted model |
df.error |
error degrees of freedom of unrestricted model |
s2 |
MSE of unrestricted model |
Sigma |
variance covariance matrix of beta-hat in unrestricted model |
origmodel |
unrestricted model itself ( |
ui |
as input |
ci |
as input |
restr.index |
the input vector index |
meq |
as input |
iact |
active restrictions, i.e. restrictions that are satisfied with
equality in the solution, as output by |
bootout |
object of class boot obtained by bootstrapping,
will be used by summary.orlm for calculating bootstrap confidence
intervals; |
Note
Package versions up to 1.1-4 had a bug in function ic.test that caused the p-value of the overall model test to be too large.
Author(s)
Ulrike Groemping, BHT Berlin
References
Shapiro, A. (1988) Towards a unified theory of inequality-constrained testing in multivariate analysis. International Statistical Review 56, 49–62
See Also
See also ic.est
, ic.test
,
or.relimp
, solve.QP
Examples
limo <- lm(swiss)
## restricted linear model with restrictions that
## - Education and Examination have same coefficient
## - Catholic and Infant.Mortality have non-negative coefficients
orlimo <- orlm(limo, ui=rbind(c(0,1,-1,0,0),c(0,0,0,1,0),c(0,0,0,0,1)), meq=1)
orlimo
plot(orlimo)
summary(orlimo)
## same model using index vector
orlimo <- orlm(limo, ui=rbind(c(1,-1,0,0),c(0,0,1,0),c(0,0,0,1)), index=3:6, meq=1)
## reduced number of bootstrap samples below reasonable size for example run time
orlimo <- orlm(limo, ui=rbind(c(1,-1,0,0),c(0,0,1,0),c(0,0,0,1)),
index=3:6, meq=1, boot=TRUE, B=100)
summary(orlimo)
## bootstrap considering data as fixed
orlimof <- orlm(limo, ui=rbind(c(1,-1,0,0),c(0,0,1,0),c(0,0,0,1)),
index=3:6, meq=1, boot=TRUE, B=100, fixed=TRUE)
summary(orlimof, brief=TRUE)