predict_codalm {codalm} | R Documentation |
Obtains compositional predictions for new compositional covariates using an established codalm model.
predict_codalm(object, newx)
object |
A |
newx |
A matrix of compositional predictors. Each row is an observation, and must sum to 1. If any rows do not sum to 1, they will be renormalized |
A D_s
x D_r
compositional coefficient matrix, where
D_s
and D_r
are the dimensions of the compositional predictor
and outcome, respectively
data("educFM")
father <- as.matrix(educFM[,2:4])
y <- father / rowSums(father)
mother <- as.matrix(educFM[,5:7] )
x <- mother/rowSums(mother)
codalm_model <- codalm(y[1:20,], x[1:20,])
predict_codalm(codalm_model, x[-(1:20),])