Displaying 2 results from an estimated 2 matches for "nchist".
2006 Aug 04
2
Doubt about Student t distribution simulation
..., what is wrong with the
simulation below? I think that the theoretical curve should agree with
the relative frequencies of the t values calculated:
#== begin options=====
# parameters
mu = 10
sigma = 5
# size of sample
n = 3
# repetitions
nsim = 10000
# histogram parameter
nchist = 150
#== end options=======
t = numeric()
pop = rnorm(10000, mean = mu, sd = sigma)
for (i in 1:nsim) {
amo.i = sample(pop, n, replace = TRUE)
t[i] = (mean(amo.i) - mu) / (sigma / sqrt(n))
}
win.graph(w = 5, h = 7)
split.screen(c(2,1))
screen(1)
hist(t,
main = "histogram...
2004 Dec 17
2
Doubts about chi-square distribution
...-- Begin informations -----------------------------------
# Populational parameters
Mpop = 0 # Mean
Vpop = 1 # Variance
N = 10000 # Size
# Sampling
n = 10 # size of the sample
sr = 10000 # sampling repetition
# Plot parameter
nchist = 150
#---------------------- End informations -------------------------------------
CScal = numeric(); # CScal = Chi-square calculated
pop = rnorm(N, Mpop, sqrt(Vpop)) # pop~N(Mpop,Vpop)
for (i in 1:sr)
{
amo = sample(pop, n, replace = TRUE)
#========================...