View source: R/PLNmixturefit-S3methods.R
predict.PLNmixturefit | R Documentation |
PLNmixturefit
objectPredict either posterior probabilities for each group or latent positions based on new samples
## S3 method for class 'PLNmixturefit'
predict(
object,
newdata,
type = c("posterior", "response", "position"),
prior = matrix(rep(1/object$k, object$k), nrow(newdata), object$k, byrow = TRUE),
control = PLNmixture_param(),
...
)
object |
an R6 object with class |
newdata |
A data frame in which to look for variables, offsets and counts with which to predict. |
type |
The type of prediction required. The default |
prior |
User-specified prior group probabilities in the new data. The default uses a uniform prior. |
control |
a list-like structure for controlling the fit. See |
... |
additional parameters for S3 compatibility. Not used |
A matrix of posterior probabilities for each group (if type = "posterior"), a matrix of (average) position in the latent space (if type = "position") or a vector of predicted groups (if type = "response").
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPLN <- PLNmixture(Abundance ~ 1 + offset(log(Offset)),
data = trichoptera, control = PLNmixture_param(smoothing = "none")) %>% getBestModel()
predict(myPLN, trichoptera, "posterior")
predict(myPLN, trichoptera, "position")
predict(myPLN, trichoptera, "response")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.