[R] simulation of Hierarchical design

Greg Snow 538280 at gmail.com
Tue Feb 25 00:19:47 CET 2014

So can the same student be associated with multiple instructors?  only
within the same school? or more general?  by repeated student ID's do
you mean that a student in school A and a student in school B can both
have ID 1, but they are different students? or do you mean that
instructor #1 and Instructor #2 in the same school can both have
student ID 1 and that it is the same student?

What do you want the effect of state, school, and instructor to be on
your outcome variable?

A couple of the examples for the simfun function in the TeachingDemos
package do simulations for hierarchical designs (the last 3 examples),
in this case simulating height for subjects nested in cities nested in
states assuming that each have an effect on height.  You could modify
one of those to match your story (use a binomial instead of normal, or
use normal and a cut-off value).

On Mon, Feb 24, 2014 at 11:58 AM, farnoosh sheikhi
<farnoosh_81 at yahoo.com> wrote:
> Hi,
> I want to simulate a data set with following condition:
> There are 6 states with 12 schools. Each two schools are coming from one states. For example school one and two from state A, school 3 and 4 from state B and etc.
> Each school has 10 unique instructors with random number of students meaning that there are repeated IDs( student ID). For each school, there is an indicator telling if the school has a diet program or not.
> There is also an indicator telling if student has been on diet or not. (possible response).
> There is also a variable stating the state name. state A, state B, etc.
> I want to create a data set in R based on this story.
> I really appreciate any help and direction.
> Regards, Farnoosh Sheikhi
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

More information about the R-help mailing list