These functions are used by the Linear Regression dialog.
menuLm
calls
tabSummary.lm,
tabPlot.lm and
tabPredict.lm
if summary, plotting and prediction results are requested.
a formula object, with the response on the left of a `~' operator,
and the terms, separated by
+ operators, on the right.
lmobj
an object that inherits from class
lm.
OPTIONAL ARGUMENTS:
data
a
data.frame in which to interpret the variables named in the
formula, or in the
subset and the
weights argument.
If this is missing, then the variables in the formula should be on the
search list.
weights
vector of observation weights; if supplied,
the algorithm fits to minimize the sum
of the weights multiplied into the squared residuals.
The length of
weights must be the same as the number of observations.
The weights must be nonnegative and it is strongly recommended that they
be strictly positive, since zero weights are ambiguous, compared to use
of the
subset argument.
subset
expression saying which subset of the rows of the data
should be used in the fit.
This can be a logical vector (which is replicated to have length equal
to the number of observations), or a numeric vector indicating which
observation numbers are to be included, or a character vector of the
row names to be included.
All observations are included by default.
na.omit.p
if
TRUE, then any observation with missing values are removed
from the analysis.
If
FALSE and there are missing values then the function will exit
with a message that missing values are not allowed.
f
na.omit.p is
TRUE then
na.action is set to
na.omit in the
call to
lm.
If
na.omit.p is
FALSE then
na.action is set to
na.fail in the
call to
lm.
print.short.p
if
TRUE, a short summary of the linear regression is printed.
This output is from the function
print.lm.
print.long.p
if
TRUE, a long summary of the linear regression is printed.
This output is from the function
summary.lm.
print.anova.p
if
TRUE, an ANOVA table for the linear regression is printed.
This output is from the function
anova.lm.
print.correlation.p
if
TRUE, the correlation matrix of the regression coefficients is
printed. This is only available if
print.long.p is
TRUE and
results in calling
summary.lm with
correlation=TRUE.
save.name
a character string for the name of the data frame to save the
fit and residuals in.
If data frame with this name already exists in database 1 and it has the
appropriate number of rows then the saved values will be appended
to the data frame.
If the object already exist in database 1 and it is not a data frame
or it does not have the appropriate number of rows then a new name
is created by appending a number to
save.name and the results are
saved in the data frame with the new name.
save.fit.p
if
TRUE, the fitted values from the regression are saved in the
data frame
save.name.
save.resid.p
if
TRUE, the residuals from the regression are saved in the
data frame
save.name.
plotResidVsFit.p
if
TRUE, a plot of the residuals versus the fitted values is created.
plotSqrtAbsResid.p
if
TRUE, a plot of the absolute value of the square root of the
residuals versus the fitted values is created.
This plot is useful for checking for the constant variance assumption
of the model.
plotResponseVsFit.p
if
TRUE, a plot of the response versus the fitted values is created.
plotQQ.p
if
TRUE, a Normal quantile-quantile plot of the residuals is created.
plotRFSpread.p
if
TRUE, a residual-fit spread plot is created.
This is a visual analog to the multiple R-squared statistic.
It compares the spread of the fitted values to the spread of the residuals.
plotCooks.p
if
TRUE, a plot of Cooks distance values versus the observation
number is created.
smooths.p
if
TRUE a smooth curve, computed with
loess.smooth
is displayed on the Residuals vs Fit,
Sqrt Abs Residuals vs Fit and Response vs Fit plots.
rugplot.p
if
TRUE, a rugplot is displayed on the Residuals vs Fit,
Sqrt Abs Residuals vs Fit and Response vs Fit plots.
A rugplot is a sequence of vertical bars along the x-axis that mark the
"observed" x values.
id.n
the number of extreme points that will be identified on the
Residuals vs Fit, Sqrt Abs Residuals vs Fit, Residual's Normal QQ
and Cook
s Distance plots. The row names from the models data frame
will be used to identify the points.
plotPartialResid.p
if
TRUE, partial residual plots for all the terms in the model
will be created.
plotPartialFit.p
if
TRUE, the partial fit for the term is also displayed on the
partial residual plots.
rugplotPartialResid.p
if
TRUE, a rugplot is displayed on the partial residual plots.
A rugplot is a sequence of vertical bars along the x-axis that mark the
"observed" x values.
scalePartialResid.p
if
TRUE, all the partial residual plots will have the same vertical units.
This is essential for comparing the importance of fitted terms
in additive models.
newdata
a data frame to use for computing predictions.
It must contain the same names as the terms in the right side of the
formula for the model.
If missing, the predictions for the original data are computed.
predobj.name
a character string for the name of the data frame to save the
predictions, standard errors and confidence intervals in.
If data frame with this name already exists in database 1 and it has the
appropriate number of rows then the values will be appended
to the data frame.
If the object already exist in database 1 and it is not a data frame
or it does not have the appropriate number of rows then a new name
is created by appending a number to
predobj.name and the values are
saved in data frame with the new name.
predict.p
if
TRUE, the predicted values are saved in
predobj.name.
ci.p
if
TRUE, lower and upper confidence limits will be stored in the
predobj.name The column names will be "xx % L.C.L." and "xx% U.C.L"
where xx is the value specified in
conf.level.
These confidence limits are for the mean response and are computed as
the prediction plus/minus t-value * standard error.
se.p
if
TRUE, the pointwise standard errors for the predictions will be
stored in
predobj.name.
conf.level
the confidence level to use when computing confidence intervals.
VALUE:
an object of class
lm. See the
lm.object help file for details.
SIDE EFFECTS:
Plots will be drawn if requested.
The objects
save.name and
predobj.name will be created or appended
to if fitted values, residuals or predictions are saved.