Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Stat319 Oct. 22, 2004 Fall 2004 Simulations for Coverage Probability of Confidence Intervals for sample mean. I. Simulation with Normal data. Generate 100 samples with size n = 10. Calc> Random Data> Normal> Generate “10” rows of data; Store in columns: “C1C100”, with mean =0 and Standard deviation =1. OK. Calculate sample mean and standard error. Data> Stack > Columns> Stack the following columns: “C1-C100”; under Store stacked data in: select Column of current worksheet and fill “Data”, Store subscripts in “Sample”. Stat> Basic Statistics> Store Descriptive Statistics> select “Data” and “Sample” for Variables and By variables (optional); click Statistics, select “Mean” “SE of Mean”. OK, OK. Find the 90% confidence interval for sample mean. Find the inverse cumulative probability for t-distribution with degree of freedom 9: Input 0.95 to C106. Calc> Probability Distributions> t > Select “Inverse cumulative probability”; fill “9” for degree of freedom; select “C106” , OK. Thus t 9,0.95 1.8331 Calculate the lower and upper bound for the confidence interval Calc>Calculator>type “C107” for Store result in variable. Then write “C104 – 1.8331*C105”, for lower bound. Calc>Calculator>type “C108” for Store result in variable. Then write “C104 + 1.8331*C105”, for upper bound. Count the number of confidence intervals which include “0” . Calc>Calculator>type “C109” for Store result in variable. Then write “(C107<0) and (0<108)”. Thus if the CI contains “0”, the output will be “1”, otherwise “0” Calc>Calculator>type “C110” for Store result in variable. Then write sum(C109)”. This gives us the total number of “1”. We will repeat all process to Binomial data II. Simulations with Binomial Data. Calc> Random Data> Bin> Generate “1000” rows of data; Store in columns: “C1”, Number of trials = 20 and Probability = 0.6 Calculate sample mean and standard error. Calc>Calculator>type “C2” for Store result in variable. Then write “C1 / 20”. This gives us the estimated proportions (sample mean). Calc>Calculator>type “C3” for Store result in variable. Then write “SQRT(C2 * (1 - C2) / 20)”. This gives us the standard error for sample mean. Find the 95% confidence interval for sample mean. z z 0.025 1.96 2 Calculate the lower and upper bound for the confidence interval Calc>Calculator>type “C4” for Store result in variable. Then write “C2 – 1.96*C3”, for lower bound. Calc>Calculator>type “C5” for Store result in variable. Then write “C2 + 1.96*C3”, for upper bound. Count number of confidence interval including “0.6” or not. Calc>Calculator>type “C6” for Store result in variable. Then write (c4<0.6) and (c5>0.6)”. Thus if the CI contains “0.6”, the output will be “1”, otherwise “0” Calc>Calculator>type “C7” for Store result in variable. Then write sum(C6)”. This gives us the total number of “1”.