Dear varin sacha
On Sun, May 19, 2019 at 5:14 PM varin sacha via R-help
wrote:
>
> Dear Boris,
>
> Great But what about Mark in your R code ? Don't we have to precise in
> the R code that mark ranges between 1 to 6 (1 ; 1.5 ; 2 ; 2.5 ; 3 ; 3.5 ; 4 ;
> 4.5 ; 5 ; 5.5 ; 6) ?
I think Boris is
Dear varin sacha,
I think it will help us help you, if you give a clearer description of
what exactly you want.
I assume the situation is that you know what a data structure you
want, but do not know
how to conveniently create such structure.
And that is where others can help you.
So, please, des
Dear varin sacha,
Not very sure what you want, but will the following help a little?
tmp <- rep(c("C1","C2","C3","C4","C5","C6"), 50) # make a character
vector, with 50 "C1", 50 "C2", ...
classroom <- tmp[sample(1:300)] # make a random permutation.
Certainly you may also make it into one line:
c
My mental model for such a simulation is that you create data from a known
distribution, then use your model to check that you can recover the known
parameters from the data. Thus how the marks are created depends on what
influences them. Here is a toy model to illustrate this - expanding on my
Dear Boris,
Great But what about Mark in your R code ? Don't we have to precise in the
R code that mark ranges between 1 to 6 (1 ; 1.5 ; 2 ; 2.5 ; 3 ; 3.5 ; 4 ; 4.5 ;
5 ; 5.5 ; 6) ?
By the way, to fit a linear mixed model, I use lme4 package and then the lmer
function works with the varia
Fair enough - there are additional assumptions needed, which I make as follows:
- each class has the same size
- each teacher teaches the same number of classes
- the number of boys and girls is random within a class
- there are 60% girls (just for illustration that it does not have to be
Many thanks to all of you for your responses.
So, I will try to be clearer with a larger example. Te end of my mail is the
more important to understand what I am trying to do. I am trying to simulate
data to fit a linear mixed model (nested not crossed). More precisely, I would
love to get at t
On 5/18/2019 1:03 PM, varin sacha via R-help wrote:
Dear Boris,
Yes, top-down, no problem. Many thanks, but in your code did you not forget
"teacher" ? As a reminder teacher has to be nested with classes. I mean the 50
pupils belonging to C1 must be with (teacher 1) T1, the 50 pupils belongi
Dear Boris,
Yes, top-down, no problem. Many thanks, but in your code did you not forget
"teacher" ? As a reminder teacher has to be nested with classes. I mean the 50
pupils belonging to C1 must be with (teacher 1) T1, the 50 pupils belonging to
C2 with T2, the 50 pupils belonging to C3 with T3
Can you build your data top-down?
schools <- paste("s", 1:6, sep="")
classes <- character()
for (school in schools) {
classes <- c(classes, paste(school, paste("c", 1:5, sep=""), sep = "."))
}
pupils <- character()
for (class in classes) {
pupils <- c(pupils, paste(class, paste("p", 1:10,
Many thanks Jeff and Linus,
Yes to Jeff,
OK with Linus but
classroom <- rep(c("C1","C2","C3","C4","C5","C6"), 50) [sample(1:300)]
how can I include the nested structure, I mean the teacher. Now, I would like
the 50 pupils belonging to C1 with T1, the 50 pupils belonging to C2 with T2,
th
Wouldn't the students/teachers/schools be enumerated and the properties you are
studying be random/correlated according to the enumerated values?
On May 18, 2019 6:57:06 AM PDT, varin sacha via R-help
wrote:
>Dear R-Experts,
>
>In a data simulation, I would like a balanced distribution with a
>
12 matches
Mail list logo