Use R-Studio to solve, Show ALL codes: In computing the confidence interval for
ID: 3222432 • Letter: U
Question
Use R-Studio to solve, Show ALL codes:
In computing the confidence interval for a difference in means, if we knew that the population variances are the same, then we can pool the variances, estimating the common variance using all the data. Pooling the variances provides only a small gain when the variances are the same, but can be badly off when the variances are different. We cautioned against using this result since, in practice, it is difficult to determine whether the population variances are indeed the same. Run a simulation to see how well the confidence interval for the difference in means compare in the pooled and un-pooled variance cases when the population variances are not the same. (a) Execute and Explain the following code: pooledCountExplanation / Answer
(a)The codes
To count variables pooledCount and unpooledCount are initialized to 0.To draw random sample from two normal populations their sample sizes are defined by m=20 and n=10 respectively. The population mean and sd for the first population is 8 and 10 while for second population is 3 and 15 respectively. A simulation is run 100000 times and 95% Confidence interval has been generated each time assuming equal variance as CI.pooled and unequal variance as CI.unpooled. pooledCount and unspooledCount are the number of confidence intervals including (-5, 5).
(b) Running the codes we obtained chances in case of assumption of equal variance is .91572 while in assumption of unequal variance is .94995. Assumption of unequal variance gave better performance.
(c)When m=80, n=40
pooledCount/N=.915
unpooledCount/N=.95005
When m=120, n=80
pooledCount/N=.93118
unpooledCount/N=.95102
When m=80, n=80
pooledCount/N=.9503
unpooledCount/N=.9507
(d) In all the cases in (c) we find chances of including (-5, 5) is high in case of the assumption of unequal variances.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.