Posterior probabilities based on a group-based multivariate trajectory model
Posterior probabilities based on a group-based multivariate trajectory model
Computation of posterior probabilities for new units.
posterior(x, newdata=NULL)
Arguments
x: Object of class gbmt.
newdata: Object of class data.frame containing the multivariate time series of the indicators for the new units. If NULL (the default), posterior probabilities of the sample units are returned. If newdata is not NULL, it must include the variable identifying the time points. If newdata does not include the variable identifying the units, it is assumed that all observations refer to the same unit.
Returns
An object of class data.frame with one entry for each unit, containing the posterior probability of each group for that unit.
Note
Data in newdata must be expressed on the original scale of the indicators. Normalisation is applied internally.
See Also
gbmt .
Examples
data(agrisus2)# names of indicators (just a subset for illustration)varNames <- c("TFP_2005","NetCapital_GVA","Income_rur","Unempl_rur","GHG_UAA","GNB_N_UAA")# model with 2 polynomial degrees and 3 groupsm3_2 <- gbmt(x.names=varNames, unit="Country", time="Year", d=2, ng=3, data=agrisus2, scaling=4)# pretend that 'Italy' is a new unitposterior(m3_2, newdata=agrisus2[which(agrisus2$Country=="Italy"),])# consider only the last 3 yearsposterior(m3_2, newdata= agrisus2[which(agrisus2$Country=="Italy"&agrisus2$Year>=2016),])# provide more than one new unitposterior(m3_2, newdata= agrisus2[which(agrisus2$Country%in%c("Italy","Austria","Greece")),])