At first, I thought I understood what will the rt()
function in R generate - I thought it generates random t-values
from the specified t-distribution.
For example, this function tdist <- rt(10000,19)
generates, I interpreted, 10,000 t-values from a t-distribution that based on n=20 (df=19), with mean=0 and standard deviation=1.
Is that the case, or does it generate average scores (means)
that are to be found under the specified t-distribution?
If the latter is the case, how can I generate from a t-distribution 10,000 times a n=20 sample with specifications mean=0, sd=1?
Thank you in advance!
Yes, rt(n, df)
generates n
random samples from t-distribution with df
degrees of freedom.
with mean=0 and standard deviation=1.
True about distribution mean (though sampled mean would be different), but standard deviation for t-distribution is ALWAYS not a 1, but a bit larger, equal to sqrt(df/(df-2))
, sqrt(19/17)=1.057 in your case.
Lets put some code (MS R open 3.5.3, Win10 x64)
q <- rt(10000, 19)
mean(q)
prints
-0.008859063
sd(q)
prints
1.049836
and
hist(q)
plots