Description Usage Arguments Details Value Examples

View source: R/gen_mixed_data.R

This function simulates mixed-type data sets with a latent cluster structure, with continuous and nominal variables.

1 2 | ```
genMixedData(sampSize, nConVar, nCatVar, nCatLevels, nConWithErr, nCatWithErr,
popProportions, conErrLev, catErrLev)
``` |

`sampSize` |
Integer: Size of the simulated data set. |

`nConVar` |
The number of continuous variables. |

`nCatVar` |
The number of categorical variables. |

`nCatLevels` |
Integer: The number of categories per categorical variables. Currently must be a multiple of the number of populations specified in popProportions. |

`nConWithErr` |
Integer: The number of continuous variables with error. |

`nCatWithErr` |
Integer: The number of categorical variables with error. |

`popProportions` |
A vector of scalars that sums to one. The length gives the number of populations (clusters), with values denoting the prior probability of observing a member of the corresponding population. NOTE: currently only two populations are supported. |

`conErrLev` |
A scalar between 0.01 and 1 denoting the univariate overlap between clusters on the continuous variables specified to have error. |

`catErrLev` |
Univariate overlap level for the categorical variables with error. |

This function simulates mixed-type data sets with a latent cluster structure. Continuous variables follow a normal mixture model, and categorical variables follow a multinomial mixture model. Overlap of the continuous and categorical variables (i.e. how clear the cluster structure is) can be manipulated by the user. Overlap between two clusters is the area of the overlapping region defined by their densities (or, for categorical variables, the summed height of overlapping segments defined by their point masses). The default overlap level is 0.01 (i.e. almost perfect separation). A user-specified number of continuous and categorical variables can be specified to be "error variables" with arbitrary overlap within 0.01 and 1.00 (where 1.00 corresponds to complete overlap). NOTE: Currently, only two populations (clusters) are supported. While exact control of overlap between two clusters is straightforward, controlling the overlap between the K choose 2 pairwise combinations of clusters is a more difficult task.

A list with the following elements:

`trueID` |
Integer vector giving population (cluster) membership of each observation |

`trueMus` |
Mean parameters used for population (cluster) centers in the continuous variables |

`conVars` |
The continuous variables |

`errVariance` |
Variance parameter used for continuous error distribution |

`popProbsNoErr` |
Multinomial probability vectors for categorical variables without measurement error |

`popProbsWithErr` |
Multinomial probability vectors for categorical variables with measurement error |

`catVars` |
The categorical variables |

1 2 3 4 | ```
dat <- genMixedData(100, 2, 2, nCatLevels=4, nConWithErr=1, nCatWithErr=1,
popProportions=c(0.3,0.7), conErrLev=0.3, catErrLev=0.2)
with(dat,plot(conVars,col=trueID))
with(dat,table(data.frame(catVars[,1:2],trueID)))
``` |

kamila documentation built on Feb. 18, 2018, 9:01 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.