| smof-methods {smof} | R Documentation |
Methods for smof objects
Description
The list of methods that apply to smof objects
Usage
## S3 method for class 'smof'
print(x, ...)
## S3 method for class 'smof'
plot(x, which, ...)
## S3 method for class 'smof'
summary(object, ...)
## S3 method for class 'summary.smof'
print(x, ...)
## S3 method for class 'smof'
predict(object, newdata, ...)
Arguments
object |
an object returned by |
x |
an object returned by |
which |
either a vector or a two-elements list; see ‘Details’ for full specification. |
newdata |
a data frame which includes ordered factors with the same names
and levels as those in the data frame used to produce |
... |
arguments passsed through to other methods. |
Details
There are two main parts in the outcome of summary.smof. One is the
outcome of the selection of the factor(s) transformation(s); the other part,
denoted Final fitting call, represents the newly fitted model
with the original ordered factors replaced by numeric scores.
The corresponding data.frame, denoted new.data, is one
of the components of the object returned by smof.
If which is a character vector, its components are interpreted as
names of the factors in the calling statement of the object to be
plotted, producing a set of
graphs where the numeric scores of each named factor are plotted versus
the equally spaced ticks associated to the original level names.
The same effect is obtained when which is a numeric vector of integers,
which then select the corresponding components of the factors sequence.
If which is a list, its first element is assumed to be a vector having
the meaning just described. After the pertaining set of graphs has been
completed, the second element of the list is passed to the plotting method
for the object produced by the model fitting procedure.
Currently this option operates only for objects which inherits from class
lm; specifically, it works for objects originated by a call to
lm or to glm.
With predict.smof, the outcome of a smof fit is applied
to new data frame which includes ordered factors analogous to those used to
compute the smof transformation.
Only the factors of newdata with the same name as those processed by
smof to produce object are examined. The levels of these
factors must coincide with or be a subset of those of the original data frame.
There is a difference between the role played by predict.smof and
the one of predict methods for other classes. Usually the returned
values pertain to the response variable, or to some related entity,
while here the outcome refers to explanatory variables.
Value
For summary.smof, a list. For predict.smof, a data frame.
Author(s)
Adelchi Azzalini
See Also
Examples
library(datasets)
data(esoph)
contrasts(esoph$agegp, 2) <- contr.poly(6)
contrasts(esoph$tobgp, 1) <- contr.poly(4)
fit1 <- glm(cbind(ncases, ncontrols) ~ agegp + tobgp + alcgp, family=binomial(), data=esoph)
smof1 <- smof(fit1, esoph, "alcgp")
print(smof1)
print(summary(smof1))
plot(smof1, type="b", pch=19, col="blue")
plot(smof1, which=list(1, 1:4))
predict(smof1, newdata=esoph[seq(1, 88, by=8), ])