residuals {xnet} | R Documentation |
calculate residuals from a tskrr model
Description
This function returns the residuals for
an object inheriting from class tskrr
Usage
residuals(object, ...)
## S3 method for class 'tskrr'
residuals(
object,
method = c("predictions", "loo"),
exclusion = c("interaction", "row", "column", "both"),
replaceby0 = FALSE,
...
)
## S4 method for signature 'tskrr'
residuals(
object,
method = c("predictions", "loo"),
exclusion = c("interaction", "row", "column", "both"),
replaceby0 = FALSE,
...
)
Arguments
object |
a tskrr model |
... |
arguments passed from/to other methods. |
method |
a character value indicating whether the residuals should be based on the predictions or on a leave-one-out crossvalidation. |
exclusion |
a character value with possible values "interaction", "row", "column", "both" for heterogeneous models, and "edges", "vertices", "interaction" or "both" for homogeneous models. Defaults to "interaction". See details. |
replaceby0 |
a logical value indicating whether the interaction
should be simply removed ( |
Details
The parameter exclusion
defines what is left out.
The value "interaction" means that a single interaction is removed.
In the case of a homogeneous model, this can be interpreted as the
removal of the interaction between two edges. The values "row" and
"column" mean that all interactions for a row edge resp. a column
edge are removed. The value "both" removes all interactions for
a row and a column edge.
In the case of a homogeneous model, "row" and "column" don't make sense and will be replaced by "both" with a warning. This can be interpreted as removing vertices, i.e. all interactions between one edge and all other edges. Alternatively one can use "edges" to remove edges and "vertices" to remove vertices. In the case of a homogeneous model, the setting "edges" translates to "interaction", and "vertices" translates to "both". For more information, see Stock et al. (2018).
Replacing by 0 only makes sense when exclusion = "interaction"
and the
label matrix contains only 0 and 1 values. The function checks whether
the conditions are fulfilled and if not, returns an error.
Value
a matrix(!) with the requested residuals
Examples
data(drugtarget)
mod <- tskrr(drugTargetInteraction, targetSim, drugSim,
lambda = c(0.01,0.01))
delta <- response(mod) - loo(mod, exclusion = "both")
resid <- residuals(mod, method = "loo", exclusion = "both")
all.equal(delta, resid)