From: Yulei He <yuleih_at_umich.edu>

Date: Sat 17 Jul 2004 - 06:40:43 EST

Yulei He

1586 Murfin Ave. Apt 37

Ann Arbor, MI 48105-3135

yuleih@umich.edu

https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 17 06:47:49 2004

Date: Sat 17 Jul 2004 - 06:40:43 EST

Dear all:

I am using R to do multiple imputation for longitudinal data set. The Gibbs chain basically requires draw posterior distribution of model parameters, including the random effects. The multiple imputation requires several independent Gibbs chains. So my program structure is like:

for (chain in 1:5)

{

# perform Gibbs sampling...

for (row in 1:row.no)

{

b.row=some function # draw random effects from each row of the data
matrix;

...

}

...

}

I used two for loops. I know that for loops should be avoided in R. Since the Gibbs chains are independent, so does the draw of the random effects for the data matrix, I am just wondering if there exists faster command in R to do above operation. I happen to see function sapply(), will it be faster than my double for loops? Your help will be greatly appreciated.

Yulei

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Yulei He

1586 Murfin Ave. Apt 37

Ann Arbor, MI 48105-3135

yuleih@umich.edu

734-647-0305(H) 734-763-0421(O) 734-763-0427(O) 734-764-8263(fax) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ______________________________________________R-help@stat.math.ethz.ch mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 17 06:47:49 2004

*
This archive was generated by hypermail 2.1.8
: Wed 03 Nov 2004 - 22:55:03 EST
*