predict.MoE_expert | R Documentation |
Predictions (point estimates) of observation-specific component means from each (non-noise) component's expert network linear regression.
## S3 method for class 'MoE_expert'
predict(object,
newdata = NULL,
simplify = FALSE,
droplevels = FALSE,
...)
## S3 method for class 'MoE_expert'
fitted(object,
...)
## S3 method for class 'MoE_expert'
residuals(object,
...)
object |
An object of class |
newdata |
A matrix or data frame of test examples. If omitted, the fitted values are used. |
simplify |
Logical indicating whether to simplify the output (in the form of a list) to a 3-dimensional array with dimensions given by the number of new observations, the number of variables, and the number of clusters. The first dimension of such an array is of length |
droplevels |
A logical indicating whether unseen factor levels in categorical variables within |
... |
Catches unused arguments or allows the |
This function is effectively just a shortcut to lapply(x$expert, predict.lm, newdata=...)
. It can also be thought of as a wrapper to predict.MoEClust(x, ...)$mean
, although it returns a list (by default) rather than a 3-dimensional array and also always preserves the dimensions of newdata
, even for models without expert network covariates.
For simplify=FALSE
, either a list of vectors or predictions (for univariate data) or a list of matrices of predictions (for multivariate data). These lists are of the same length as number of non-noise components in the fitted model. When simplify=TRUE
, a 3-dimensional array of predictions is returned, with respective dimensions given by the number of observations, variables, and non-noise components.
Keefe Murphy - <keefe.murphy@mu.ie>
predict.MoEClust
, lm
, predict.MoE_gating
, drop_levels
data(CO2data)
res <- MoE_clust(CO2data$CO2, G=3, equalPro=TRUE, expert= ~ GNP, network.data=CO2data)
predict(res$expert)
# Try with newdata and simplify=TRUE
predict(res$expert, newdata=CO2data[1:5,"GNP", drop=FALSE], simplify=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.