Learn R Programming

ProfileGLMM (version 1.0.2)

profileGLMM_predict: Prediction of cluster memberships and outcomes

Description

This function uses the results of the post-processed Profile GLMM MCMC chain to predict cluster memberships and outcomes for new or existing data. It first calculates the fixed effect (FE) contribution and then, if a representative clustering is available in post_Obj, computes the predicted cluster membership and the corresponding latent effect (Lat) contribution to the outcome.

Usage

profileGLMM_predict(post_Obj, XFE, XLat, UCont, UCat)

Value

A list with the following elements:

FE:

A numeric vector of the predicted fixed effects contribution to the outcome.

Y:

A numeric vector of the total predicted outcome (FE + Lat).

classPred:

A factor vector of the predicted cluster membership for each observation. NULL if no representative clustering was provided in post_Obj.

Int:

A numeric vector of the predicted latent effect contribution to the outcome. NULL if no representative clustering was provided.

Arguments

post_Obj

The post-processed output from the profileGLMM_postProcess function. Must contain pop for population constant parameters and optionally clust for cluster-specific parameters.

XFE

A numeric matrix of fixed effects covariates for the prediction data.

XLat

A numeric matrix of latent effect covariates. This matrix is used for the interaction term with the predicted cluster membership.

UCont

A numeric matrix or vector of continuous profile variables (used for predicting cluster membership). Set to NULL if no continuous variables were used in the model.

UCat

A numeric matrix or vector of categorical profile variables (used for predicting cluster membership). Set to NULL if no categorical variables were used in the model.

Examples

Run this code
# Load post_Obj, the result of profileGLMM_postProcess()
data("examp")
post_Obj = examp$post_Obj
# Load dataProfile, the result of profileGLMM_preProcess()
dataProfile = examp$dataProfile
pred_Obj = profileGLMM_predict(post_Obj,
                               dataProfile$d$XFE,
                               dataProfile$d$XLat,
                               dataProfile$d$UCont,
                               dataProfile$d$UCat)

Run the code above in your browser using DataLab