MINI MINI MANI MO
%
% Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
%
\name{ore.lm}
\alias{ore.lm}
\alias{ore.stepwise}
\alias{summary.ore.lm}
\alias{logLik.ore.lm}
\alias{hatvalues.ore.lm}
\alias{vcov.ore.lm}
\alias{print.summary.ore.lm}
\alias{print.ore.stepwise}
\alias{predict.ore.lm}
\alias{plot.ore.lm}
\alias{drop1.ore.lm}
\alias{add1.ore.lm}
\concept{regression}
\title{Oracle R Enterprise Linear and Stepwise Linear Regression Models}
\description{
Model functions for fitting linear regression and stepwise linear
regression models on \code{ore.frame} data.
}
\usage{
### Fitting functions
ore.lm(formula, data, weights, contrasts = NULL, xlev = NULL,
...)
ore.stepwise(formula, data, scope,
direction = c("both", "backward", "forward", "alternate", "none"),
add.p = 0.50, drop.p = 0.10, nbest = 1, steps = 1000,
contrasts = NULL, xlev = NULL, ...)
### Specific methods for ore.lm objects
\S3method{summary}{ore.lm}(object, correlation = FALSE, symbolic.cor = FALSE, ...)
\S3method{logLik}{ore.lm}(object, REML = FALSE, ...)
\S3method{hatvalues}{ore.lm}(model, ...)
\S3method{vcov}{ore.lm}(object, ...)
\S3method{predict}{ore.lm}(object, newdata, se.fit = FALSE, scale = NULL, df = Inf,
interval = c("none", "confidence", "prediction"),
level = 0.95, na.action = na.pass, pred.var = NULL,
weights = NULL, supplemental.cols = NULL, ...)
\S3method{add1}{ore.lm}(object, scope, scale = 0, test = c("none", "Chisq", "F"),
x = NULL, k = 2, ...)
\S3method{drop1}{ore.lm}(object, scope, scale = 0, all.cols = TRUE,
test = c("none", "Chisq", "F"), k = 2, ...)
### Inherited methods for ore.lm objects
#anova(object, ...)
#coef(object, ...)
#coefficients(object, ...)
#confint(object, parm, level = 0.95, ...)
#deviance(object, ...)
#effects(object, ...)
#extractAIC(fit, scale, k = 2, ...)
#fitted(object, ...)
#fitted.values(object, ...)
#formula(x, ...)
#model.frame(formula, ...)
#nobs(object, ...)
#resid(object, ...)
#residuals(object, ...)
#weights(object, ...)
}
\arguments{
\item{formula}{A \code{\link[stats]{formula}} object representing the
model (\code{ore.lm}) or initial model (\code{ore.stepwise}) to be
fit. This formula must be of the form \code{response ~ terms}, where
the \code{response} represents a single variable and the
\code{terms} are derived from \code{ore.number} and
\code{ore.factor} columns from the \code{data} argument.}
\item{data}{An \code{ore.frame} object specifying the data for the
model. White spaces are not supported in any of the column names
used in the \code{formula} argument.}
\item{weights}{In function \code{ore.lm} an optional \code{ore.number}
object specifying the analytic weights in the model.
In function \code{predict.ore.lm} when argument \code{interval} is
\code{"prediction"} and argument \code{pred.val} is \code{NULL} and
\code{object$weights} is not \code{NULL}, the variance weights
for the predictions as either an
\code{\link[OREbase:ore.numeric-class]{ore.numeric}} object or a
one-sided model \code{\link[stats]{formula}} referring to data
within argument \code{newdata}.}
\item{ supplemental.cols }{ Additional columns to include in the prediction
result from the \code{newdata} data set. }
\item{contrasts}{An optional named \code{\link[base]{list}} to be
supplied to the \code{contrasts.arg} argument of
\code{\link[stats]{model.matrix}}.}
\item{xlev}{An optional named \code{\link[base]{list}} of
\code{\link[base]{character}} vectors specifying the
\code{\link[base]{levels}} for each
\code{\link[OREbase:ore.factor-class]{ore.factor}} variable.}
\item{scope}{The range of models to examine within the stepwise
procedure; either a single \code{\link[stats]{formula}} object
representing the upper model or a list object containing
\code{"lower"} and \code{"upper"} \code{\link[stats]{formula}}
object elements.}
\item{direction}{The stepwise search mode; one of \code{"both"} (first
try to add a term using the \code{add.p} argument value and then try
repeatedly to drop terms using the \code{drop.p} argument value),
\code{"backward"}, \code{"forward"}, \code{"alternate"} (similar to
\code{"both"} but only one drop is attempted per add attempt) or
\code{"none"} with a default of \code{"both"}.}
\item{add.p}{The F-test p-value threshold for adding a term to the
model.}
\item{drop.p}{The F-test p-value threshold for removing a term from
the model.}
\item{nbest}{The number of best models, according to the selection
criteria, to report at each step.}
\item{steps}{The maximum number of steps to make.}
\item{object, model, newdata}{\code{ore.lm} object.}
\item{correlation, symbolic.cor}{Argument not implemented.}
\item{REML}{Argument not implemented.}
\item{se.fit}{A logical value indicating whether to return the
standard errors for the predictions.}
\item{scale}{The scale parameter for standard error of the predictions.}
\item{df}{The degrees of freedom for the predictions when argument
\code{scale} is not \code{NULL}.}
\item{interval}{The type of interval to return, either \code{"none"},
\code{"confidence"}, or \code{"prediction"}.}
\item{level}{The level for argument \code{interval}.}
\item{na.action}{The manner in which \code{NA} values are handled,
either \code{na.omit} or \code{na.pass}.}
\item{pred.var}{When argument \code{interval} is \code{"prediction"},
the variance for a single observation.}
\item{test, x, k, all.cols}{See function \code{\link[stats]{add1}}.}
\item{\dots}{Additional arguments.}
}
\details{
The \code{ore.lm} and \code{ore.stepwise} functions perform least
squares regression and stepwise least squares regression
respectively on data represented in \code{ore.frame} objects.
A model fit is generated using embedded R map/reduce operations where
the map operation creates either QR decompositions or matrix
cross-products depending on the number of coefficients being
estimated. The underlying model matrices will be created using either
\code{model.matrix} or \code{sparse.model.matrix} depending on its
sparsity. Once the coefficients for the model have been estimated
another pass of the data is made to estimate the model-level statistics.
When forward, backward, or stepwise selection is performed, the XtX
and Xty matrices are subsetted to generate the F-test p-values based
upon coefficient estimates that were generated using a Choleski
decomposition of the XtX subset matrix.
If there are collinear terms in the model, functions \code{ore.lm} and
\code{ore.stepwise} will not estimate the coefficient values for
a collinear set of terms. In the case of \code{ore.stepwise},
this collinear set of terms will be excluded throughout the
procedure.
The \code{\link[OREbase:ore.options]{"ore.parallel"}} global option is
used by \code{ore.lm} to determine the preferred degree of
parallelism to use within the Oracle R Enterprise server.
}
\value{
For \code{ore.lm}, returns an \code{ore.lm} object.
For \code{summary.ore.lm}, returns a \code{summary.ore.lm} object.
For \code{ore.stepwise}, returns an \code{ore.stepwise} object.
Note: the training data referenced by argument \code{data} is needed to
produce meta information about the \code{ore.lm} object.
}
\references{
\href{http://www.oracle.com/technetwork/database/database-technologies/r/r-enterprise/documentation/index.html}{Oracle R Enterprise}
}
\author{
Oracle \email{oracle-r-enterprise@oracle.com}
}
\seealso{
\link[OREstats]{model.matrix,formula-method} (\pkg{OREstats} package),
\code{\link{ore.glm}},
\code{\link[stats]{lm}},
\code{\link[stats]{step}},
\code{\link[OREbase:ore.options]{ore.parallel}}
}
\examples{
# Create database table
library(OREstats)
LONGLEY <- ore.push(longley)
# Fit full model
oreFit1 <- ore.lm(Employed ~ ., data = LONGLEY)
summary(oreFit1)
# Two stepwise alternatives
oreStep1 <-
ore.stepwise(Employed ~ .^2, data = LONGLEY, add.p = 0.1, drop.p = 0.1)
oreStep2 <-
step(ore.lm(Employed ~ 1, data = LONGLEY),
scope = terms(Employed ~ .^2, data = LONGLEY))
}
\keyword{regression}
OHA YOOOO