reorder.earth {earth} | R Documentation |
Given an ‘earth’ object,
return an index vector ordered using the specified decomp
.
The index vector is suitable for indexing into object$selected.terms
and object$coefficients
.
## S3 method for class 'earth': reorder(x = stop("no 'x' arg"), which.terms = x$selected.terms, decomp = c("anova", "none"), degree = 99, min.degree = 0, ...)
x |
An earth object.
This is the only required argument.
|
which.terms |
Which terms to use.
Default is x$which.terms .
|
decomp |
One of"none" order the terms as created during the earth forward pass
i.e. no reordering."anova" (default) order the terms using the ‘anova decomposition’
i.e. in increasing order of interaction.
|
degree |
Maximum order of interaction.
Terms of order greater than degree will be dropped.
Default is 99 which is effectively all.
Set degree=0 to return just the intercept.
|
min.degree |
Minimum order of interaction.
Terms of order less than min.degree will be dropped.
Default is 0, meaning all.
|
... |
Unused, but provided for generic/method consistency. |
An index vector suitable for indexing into object$selected.terms
and object$coefficients
, and ordered using the specified decomp
.
data(ozone1) a <- earth(O3 ~ ., data = ozone1, degree = 2) reorder(a, decomp = "none") # yields: # [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 reorder(a) # defaults to decomp = "anova" # yields: # [1] 1 10 2 3 8 4 5 13 14 9 6 7 11 12 a$selected.terms[reorder(a)] # yields: # [1] 1 16 2 4 13 6 7 20 21 14 9 10 18 19