This function will simulate the data for the logistic mixed model: logit(y_ij)=mu+sigma* theta_i or the poisson-normal model: log(y_ij)=mu+sigma* theta_i where theta_i is N(0,1) in either case.

1 |

`num_subs` |
Index of i (number of subjects); default is NULL |

`obs_per_sub` |
Vector of length num_subs; Index of j (number of observations per subject); default is NULL |

`true.mu` |
True value of mu; default is NULL |

`true.sigma` |
True value of sigma; default is NULL |

`family` |
Exponential family from which to generate top level of hierarchy; default is "binomial" |

`set.seed` |
Random seed start value for reproducibility; default is NULL |

The user must enter values for num_subs, obs_per_sub, true.mu and true.sigma or the function will produce an error. The set.seed argument is optional.

`y` |
a matrix of generated y_ij of dimension num_subs* max(obs_per_sub) |

`y.i` |
a vector of the sums over j of y_ij; this will have length num_subs |

`n.i` |
a vector of the number of observations for each subject; this should exactly match obs_per_sub |

Lindsey Dietz

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.