hdpGLM_simParameters {hdpGLM} | R Documentation |
Simulate the parameters of the model
Description
This function generates parameters that can be used to simulate data sets from the Hierarchical Dirichlet Process of Generalized Linear Model (hdpGLM) or dpGLM
Usage
hdpGLM_simParameters(
K,
nCov = 2,
nCovj = 0,
J = 1,
pi = NULL,
same.K = FALSE,
seed = NULL,
context.effect = NULL,
same.clusters.across.contexts = NULL,
context.dependent.cluster = NULL
)
Arguments
K |
integer, the number of clusters. If there are multiple contexts, K is the average number of clusters across contexts, and each context gets a number of clusters sampled from a Poisson distribution, except if |
nCov |
integer, the number of covariates of the GLM components |
nCovj |
an integer indicating the number of covariates determining the average parameter of the base measure of the Dirichlet process prior |
J |
an integer representing the number of contexts @param parameters either NULL or a list with the parameters to generate the model. If not NULL, it must contain a sublist name beta, a vector named tau, and a vector named pi. The sublist beta must be a list of vectors, each one with size nCov+1 to be the coefficients of the GLM mixtures components that will generate the data. For the vector tau, if nCovj=0 (single-context case) then it must be a 1x1 matrix containing 1. If ncovj>0, it must be a (nCov+1)x(nCovj+1) matrix. The vector pi must add up to 1 and have length K. |
pi |
either NULL or a vector with length K that add up to 1. If not NULL, it determines the mixture probabilities |
same.K |
boolean, used when data is sampled from more than one context. If |
seed |
a seed for |
context.effect |
either |
same.clusters.across.contexts |
boolean, if |
context.dependent.cluster |
integer, indicates which cluster will be context-dependent. If |
Value
The function returns a list with the parameters used to generate data sets from the hdpGLM model. This list can be used in the function hdpGLM_simulateData
Examples
pars = hdpGLM_simParameters(nCov=2, K=2, nCovj=3, J=20,
same.clusters.across.contexts=FALSE, context.dependent.cluster=0)