Agnes Ayang
2013-Jan-07 16:13 UTC
[R] Have problem to do loop to generate transformed chi-squared variates
Hello R-helpers, I need to generate standard variates normal to 'create' chi-squared variates. To make you more understand, (1) a<-rnorm(3,0,1) *after do (1), I need to squared and summed the three values. My problem is, how am I going to continue the programming if I had to repeat the process for 15 times, which in the end I will get 15 values from the whole programme.Hope you can help. Sincerely, Agnes [[alternative HTML version deleted]]
R. Michael Weylandt
2013-Jan-07 16:37 UTC
[R] Have problem to do loop to generate transformed chi-squared variates
Hi Agnes, I think this is likely homework, right? If that's the case, we're really not supposed to give you help. If not, why not simply use rchisq to generate chi-sq variates exactly? MW On Mon, Jan 7, 2013 at 4:13 PM, Agnes Ayang <agnes.ayang at yahoo.com> wrote:> Hello R-helpers, > > I need to generate standard variates normal to 'create' chi-squared variates. To make you more understand, > > (1) a<-rnorm(3,0,1) > > *after do (1), I need to squared and summed the three values. My problem is, how am I going to continue the programming if I had to repeat the process for 15 times, which in the end I will get 15 values from the whole programme.Hope you can help. > > > Sincerely, > Agnes > [[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. >
Rolf Turner
2013-Jan-08 07:41 UTC
[R] Have problem to do loop to generate transformed chi-squared variates
Homework? We don't do people's homework for them. cheers, Rolf Turner On 01/08/2013 05:13 AM, Agnes Ayang wrote:> Hello R-helpers, > > I need to generate standard variates normal to 'create' chi-squared variates. To make you more understand, > > (1) a<-rnorm(3,0,1) > > *after do (1), I need to squared and summed the three values. My problem is, how am I going to continue the programming if I had to repeat the process for 15 times, which in the end I will get 15 values from the whole programme.Hope you can help.