rosa_results {multiblock} | R Documentation |
Result functions for ROSA models
Description
Standard result computation and extraction functions for ROSA (rosa
).
Usage
## S3 method for class 'rosa'
predict(
object,
newdata,
ncomp = 1:object$ncomp,
comps,
type = c("response", "scores"),
na.action = na.pass,
...
)
## S3 method for class 'rosa'
coef(object, ncomp = object$ncomp, comps, intercept = FALSE, ...)
## S3 method for class 'rosa'
print(x, ...)
## S3 method for class 'rosa'
summary(
object,
what = c("all", "validation", "training"),
digits = 4,
print.gap = 2,
...
)
blockexpl(object, ncomp = object$ncomp, type = c("train", "CV"))
## S3 method for class 'rosaexpl'
print(x, digits = 3, compwise = FALSE, ...)
rosa.classify(object, classes, newdata, ncomp, LQ)
## S3 method for class 'rosa'
scores(object, ...)
## S3 method for class 'rosa'
loadings(object, ...)
Arguments
object |
A |
newdata |
Optional new data with the same types of predictor blocks as the ones used for fitting the object. |
ncomp |
An |
comps |
An |
type |
For |
na.action |
Function determining what to do with missing values in |
... |
Additional arguments. Currently not implemented. |
intercept |
A |
x |
A |
what |
A |
digits |
The number of digits used for printing. |
print.gap |
Gap between columns when printing. |
compwise |
Logical indicating if block-wise (default/FALSE) or component-wise (TRUE) explained variance should be printed. |
classes |
A |
LQ |
A |
Details
Usage of the functions are shown using generics in the examples below.
Prediction, regression coefficients, object printing and summary are available through:
predict.rosa
, coef.rosa
, print.rosa
and summary.rosa
.
Explained variances are available (block-wise and global) through blockexpl
and print.rosaexpl
.
Scores and loadings have their own extensions of scores()
and loadings()
throught
scores.rosa
and loadings.rosa
. Finally, there is work in progress on classifcation
support through rosa.classify
.
When type
is "response"
(default), predicted response values
are returned. If comps
is missing (or is NULL
), predictions
for length(ncomp)
models with ncomp[1]
components,
ncomp[2]
components, etc., are returned. Otherwise, predictions for
a single model with the exact components in comps
are returned.
(Note that in both cases, the intercept is always included in the
predictions. It can be removed by subtracting the Ymeans
component
of the fitted model.)
If comps
is missing (or is NULL
), coef()[,,ncomp[i]]
are the coefficients for models with ncomp[i]
components, for i
= 1, \ldots, length(ncomp)
. Also, if intercept = TRUE
, the first
dimension is nxvar + 1
, with the intercept coefficients as the first
row.
If comps
is given, however, coef()[,,comps[i]]
are the
coefficients for a model with only the component comps[i]
, i.e., the
contribution of the component comps[i]
on the regression
coefficients.
Value
Returns depend on method used, e.g. predict.rosa
returns predicted responses
or scores depending on inputs, coef.rosa
returns regression coefficients, blockexpl
returns an object of class rosaexpl
containing block-wise and component-wise explained variance contained in a matrix with attributes.
References
Liland, K.H., Næs, T., and Indahl, U.G. (2016). ROSA - a fast extension of partial least squares regression for multiblock data analysis. Journal of Chemometrics, 30, 651–662, doi:10.1002/cem.2824.
See Also
Overviews of available methods, multiblock
, and methods organised by main structure: basic
, unsupervised
, asca
, supervised
and complex
.
Common functions for computation and extraction of results and plotting are found in rosa_results
and rosa_plots
, respectively.
Examples
data(potato)
mod <- rosa(Sensory[,1] ~ ., data = potato, ncomp = 5, subset = 1:20)
testset <- potato[-(1:20),]; testset$Sensory <- testset$Sensory[,1,drop=FALSE]
predict(mod, testset, ncomp=5)
dim(coef(mod, ncomp=5)) # <variables x responses x components>
print(mod)
summary(mod)
blockexpl(mod)
print(blockexpl(mod), compwise=TRUE)