Description Usage Arguments Details Value Author(s) See Also Examples
'regr' fits regression models of various types: ordinary, robust, quantile, Tobit, logistic, generalized linear, multinomial, ordered response, multivariate, ...
It is a wrapper function which calls the respective S fitting functions and yields an extensive result, to be used by the respective print and plot methods.
1 2 3 4 5 |
formula |
a symbolic description of the model to be fit. |
data |
data frame containing the variables in the model. |
family |
character string describing the type of model and the
fitting procedure. By default, |
nonlinear |
if TRUE, a non-linear model is expected, to be fitted
by |
start |
if |
robust |
if TRUE, robust fitting is used if a function is available, see Details. |
method |
"rq" or "quantreg" requires fitting by quantile
regression. Then, the argument |
subset |
an optional vector specifying a subset of observations to be
used in the fitting process. Names of variables in |
weights |
an optional vector of weights to be used for fitting. |
offset |
sometimes used to help specify the model. |
... |
additional arguments, which are passed to
|
object |
'summary.regr' simply returns its only argument
|
Contrasts: If (ordered) factors are generated in the formula
(like y~ordered(f1)
), the contrast functions
contr.wsum
and contr.wpoly
will be
equivalent to their unweighted versions.
Robust fitting is available for ordinary linear models, by setting
robust = TRUE
.
By default, the function lmrob
from
package robustbase
is called with the argument setting="KS2011"
.
This default will be changed in future versions.
Alternative methods can be obtained by setting the method
argument. Choosing
method="rlm"
calls function rlm
from package MASS
with default method="MM"
.
Any further elements of method
will be passed on to the methods
argument of the called function.
The 'summary' generic function does nothing to 'regr' objects, since all useful information is already collected in the object.
Logical explanatory variables are converted into numeric, in contrast to the official R fitting functions, which treat them as factors.
regr
returns a list object of class regr
and secondary class as
produced by the fitting function. The components include generally
those of the results of the fitting function and its summary.
The important additional components are:
termtable |
data.frame,
table for testing terms both for single and mulitple
degree terms (continuous or binary explanatory variables and
factors).
The columns are
The |
termeffects |
All coefficients. This is a list with a component for
each term. Each component characterizes the coefficients similar to
the |
stdresiduals |
Standardized residuals |
sigma |
estimated standard deviation for normal errors, |
leverage |
leverage values |
allvars |
data.frame: variables used for fitting the model |
binfac |
levels of binary factors |
fitfun, funcall |
R function and call that has been used for fitting the model |
Werner A. Stahel, Seminar for Statistics, ETH Zurich
lm
, glm
, rlm
,
multinom
, polr
,...
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 29 30 31 32 | data(d.blast, package="plgraphics")
( r.blast <-
regr(log10(tremor)~location+log10(distance)+log10(charge), data=d.blast) )
## Anorexia
data(anorexia, package="MASS")
r.anorexia <- regr(Postwt ~ Prewt + Treat + offset(Prewt),
data = anorexia)
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
d.dob <- data.frame(group = gl(2,10,20, labels=c("Ctl","Trt")),
weight = c(ctl, trt))
(r.dob <- regr(weight ~ group, data=d.dob))
## multinomial regression
data(d.surveyenvir)
d.surveyenvir$dist.unordered <- factor(as.character(d.surveyenvir$disturbance))
t.r <- regr(dist.unordered~age+education+location, data=d.surveyenvir)
## ordered regression
data(housing, package="MASS")
t.r <- regr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
plot(t.r)
## multivariate regression
data(d.fossileSamples, package="plgraphics")
r.mregr <-
regr(cbind(sAngle,lLength,rWidth)~SST+Salinity+lChlorophyll+Region+N,
data=d.fossileSamples)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.