[R] Simulate values
Kehl Dániel
kehld at ktk.pte.hu
Tue Apr 7 06:39:32 CEST 2015
People do not usually do homework stuff here but I do not see the point in repeating the same sample 500 times. You might want to simulate 40x500 independent samples and put those in a matrix (see ?matrix) with lets say 40 rows and 500 columns. Once done, you can apply calculate the 500 sample standard deviations (or the chi-square values) where the ?apply function might help you.
Lets start with that and lets see where you get.
kd
________________________________________
Feladó: R-help [r-help-bounces at r-project.org] ; meghatalmazó: Osiris10101 [osiris94 at gmx.ch]
Küldve: 2015. április 7. 0:52
To: r-help at r-project.org
Tárgy: [R] Simulate values
Hello,
I'm facing the following task:
Simulate 500 values of the statistic (n-1)s^2/sigma^2 based on taking 500
samples of size n=40
from the N(mu=10; sigma^2 = 25) distribution.
I think with the following command:
rep(rnorm(40,10,25),times=500)
I was able to simulate the samples but how I now can simulate the values of
the chi-square-distribution is a mystery to me...
I hope anyone can help me, shouldn't be a big problem...
Thanks in advance!
Reason for posting:
I started a course at the University of Manchester and had to catch up with
R, which I never used back in Switzerland. Now I'm solving some exercises to
get more practice and this is one of them.
--
View this message in context: http://r.789695.n4.nabble.com/Simulate-values-tp4705574.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
More information about the R-help
mailing list