[R] Student-t distributed random value generation within a confidence interval?

Thomas Schu th.schumann at gmx.de
Fri Nov 23 16:40:57 CET 2012


Dear R-users!

I´m faced with following problem:
Given is a sample where the sample size is 12, the sample mean is 30, and
standard deviation is 4.1.
Based on a Student-t distribution i´d like to simulate randomly 500 possible
mean values within a two-tailed 95% confidence interval.
Calculation of the lower and upper limit of the two-tailed confidence
interval is the easy part.

m <- 30 #sample mean
s <- 4.1 #standard deviation
n <- 12 #sample size
quant <- qt(0.975,df=11)*s/sqrt(n)#student-t with two tailed )95% confidence
interval
l <- m-quant# lower limit
h <- m+quant# upper limit

500 randomly simulated values are computable with the rt() command but this
command does not consider the 95% confidence interval.

Does somebody of you know, how i can overcome this problem?

Best regards
Thomas




--
View this message in context: http://r.789695.n4.nabble.com/Student-t-distributed-random-value-generation-within-a-confidence-interval-tp4650561.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list