Description Usage Arguments Value Author(s) Examples
Perform linear regression on variables of a data set. The output is printed as a LaTeX table that mimics the look of SPSS output (version <24), and plots of the results mimic the look of SPSS graphs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  regression(..., data, labels = NULL, change = FALSE)
## S3 method for class 'regressionSPSS'
print(x, digits = 3, statistics = c("summary", "anova", "estimates"), ...)
## S3 method for class 'regressionSPSS'
coef(object, ...)
## S3 method for class 'regressionSPSS'
df.residual(object, ...)
## S3 method for class 'regressionSPSS'
fitted(object, standardized = FALSE, ...)
## S3 method for class 'regressionSPSS'
residuals(object, standardized = FALSE, ...)
## S3 method for class 'regressionSPSS'
plot(
x,
y,
which = c("histogram", "scatter"),
main = NULL,
xlab = NULL,
ylab = NULL,
...
)

... 
for 
data 
a data frame containing the variables. 
labels 
a character or numeric vector giving labels for the regression models in the output tables. 
change 
a logical indicating whether tests on the Rsquared change should be included in model summaries. 
x, object 
an object of class 
digits 
an integer giving the number of digits after the comma to be printed in the LaTeX tables. 
statistics 
a character vector specifying which LaTeX tables should
be printed. Available options are 
standardized 
a logical indicating whether to return standardized
residuals and fitted values ( 
y 
ignored (only included because it is defined for the generic
function 
which 
a character string specifying which plot to produce. Possible
values are 
main, xlab, ylab 
the plot title and axis labels. 
An object of class "regressionSPSS"
with the following
components:
models
a list in which each component is an ojbect of class
"lm"
as returned by function lm
.
response
a character string containing the name of the response variable.
method
a character string specifying whether the nested
models are increasing in dimension by entering additional variables
("enter"
) or decreasing in dimension by removing variables
("remove"
).
change
a logical indicating whether tests on the Rsquared change are included in model summaries.
The print
method produces a LaTeX table that mimics the look of SPSS
output (version <24).
The coef
, df.residual
, fitted
and residuals
methods return the coefficients, residual degrees of freedom, fitted
values and residuals, respectively, of the last model (to mimic
SPSS functionality).
Similarly, the plot
method creates the specified plot for the
last model.
Andreas Alfons
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  # load data
data("Eredivisie")
# logtransform market values
Eredivisie$logMarketValue < log(Eredivisie$MarketValue)
# squared values of age
Eredivisie$AgeSq < Eredivisie$Age^2
# simple regression model of log market value on age
fit1 < regression(logMarketValue ~ Age, data = Eredivisie)
fit1 # print LaTeX table
plot(fit1, which = "scatter") # diagnostic plot
# add a squared effect for age
fit2 < regression(logMarketValue ~ Age + AgeSq,
data = Eredivisie, labels = 2)
fit2 # print LaTeX table
plot(fit2, which = "scatter") # diagnostic plot
# more complex models with model comparison
fit3 < regression(logMarketValue ~ Age + AgeSq,
logMarketValue ~ Age + AgeSq + Contract +
Foreign,
logMarketValue ~ Age + AgeSq + Contract +
Foreign + Position,
data = Eredivisie, labels = 2:4,
change = TRUE)
fit3 # print LaTeX table
plot(fit3, which = "histogram") # diagnostic plot

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.