Re: [R] bootstrap sample for clustered data

2018-09-18 Thread Jeff Newmiller
eptember 17, 2018 2:32 AM >To: r-help@r-project.org; Liu, Lei ; >r-help@R-project.org >Subject: Re: [R] bootstrap sample for clustered data > >You are telling us that the ID values in your data set indicate >clusters. However you went about making that determination in the first

Re: [R] bootstrap sample for clustered data

2018-09-17 Thread Liu, Lei
---Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Monday, September 17, 2018 2:32 AM To: r-help@r-project.org; Liu, Lei ; r-help@R-project.org Subject: Re: [R] bootstrap sample for clustered data You are telling us that the ID values in your data set indicate

Re: [R] bootstrap sample for clustered data

2018-09-17 Thread Jeff Newmiller
You are telling us that the ID values in your data set indicate clusters. However you went about making that determination in the first place might be an obvious(?) way to do it again with your bootstrapped sample, ignoring the cluster assignments you have in place. This is the wrong place to

[R] bootstrap sample for clustered data

2018-09-16 Thread Liu, Lei
Hi there, I posted this message before but there may be some confusion in my previous post. So here is a clearer version: I'd like to do a bootstrap sampling for clustered data. Then I will run some complicated models (say mixed effects models) on the bootstrapped sample. Here id is the

Re: [R] bootstrap sample for clustered data

2018-09-16 Thread Bert Gunter
gt; > 6 1 0 1.0 > > 7 1 0 0.9 > > 1 2 0 0.5 > > 2 2 0 0.6 > > 11 3 1 2.2 > > 12 3 1 3.0 > > 3 4 1 0.4 > > 4 4 1 0.3 > > 13 5 0 0.5 > > 21 5 0 0.6 > > > > Can you help me with it? Thanks a lot! > > > > Lei > >

Re: [R] bootstrap sample for clustered data

2018-09-16 Thread Liu, Lei
, Lei Cc: R-help Subject: Re: [R] bootstrap sample for clustered data I can't make any sense of your post. Id 3 occurs 6 times, and 2 and 5 occur twice each in your example.. How do you get (1,1,2,2,3,3,4,4,5,5) out of that? In other words, specify the mapping of old id's to new. Bert Bert Gunter

Re: [R] bootstrap sample for clustered data

2018-09-16 Thread Bert Gunter
e: > >> Sorry for the confusion. I just want to recode the id variable to 1 to 5 >> in the bootstrapped sample. This way I can do e.g., a mixed effects model >> using the new id as the cluster. Thanks! >> >> Lei >> >> >> >> *From:* Bert Gunter [mai

Re: [R] bootstrap sample for clustered data

2018-09-16 Thread Bert Gunter
I can't make any sense of your post. Id 3 occurs 6 times, and 2 and 5 occur twice each in your example.. How do you get (1,1,2,2,3,3,4,4,5,5) out of that? In other words, specify the mapping of old id's to new. Bert Bert Gunter "The trouble with having an open mind is that people keep coming

[R] bootstrap sample for clustered data

2018-09-16 Thread Liu, Lei
Hi there, I tried to generate bootstrap samples for clustered data. Here is some code I found in the web to do the work: id=c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5) y=c(.5, .6, .4, .3, .4, 1, .9, 1, .5, 2) x=c(0, 0, 1, 1, 0, 0, 1, 1, 1, 1 ) xx=data.frame(id, x, y) boot.cluster <- function(x, id){