Question
1. (2 points) Simulate 30,000 replications of the counts (for each number) of 120 rolls of a fair die and then show that: (i) the
1. (2 points)Simulate 30,000 replications of the counts (for each number) of 120 rolls of a fair die and then show that:
(i) the probability histogram of chi-square statistics looks like a chi-square distribution (you must also add the curve on top of the histogram).
(ii) A random sample was obtained of 120 rolls of a die. The results are located in the file die120rolls.txt Download die120rolls.txt.Calculate the test statistic under the null hypothesis that the die is fair. Calculate the corresponding p-value both using the simulated result and theoretically. Report your conclusion along with the p-values.
Hint 1: The R scriptM8_1_chi_square_test_after.r contains simulation code that could be very useful.
Hint 2: When importing the data in R studio, you obtain a data frame with a variable (column) namedx.
Make sure to use the variablex inside the data frame for your calculations.
"x"
"1" 4
"2" 3
"3" 5
"4" 6
"5" 6
"6" 2
"7" 6
"8" 1
"9" 1
"10" 4
"11" 5
"12" 6
"13" 4
"14" 3
"15" 3
"16" 3
"17" 6
"18" 6
"19" 5
"20" 4
"21" 5
"22" 1
"23" 3
"24" 4
"25" 3
"26" 6
"27" 6
"28" 3
"29" 2
"30" 5
"31" 4
"32" 5
"33" 6
"34" 4
"35" 5
"36" 3
"37" 4
"38" 3
"39" 2
"40" 5
"41" 5
"42" 5
"43" 3
"44" 3
"45" 6
"46" 2
"47" 5
"48" 1
"49" 3
"50" 6
"51" 1
"52" 5
"53" 6
"54" 3
"55" 2
"56" 6
"57" 1
"58" 6
"59" 5
"60" 5
"61" 5
"62" 5
"63" 6
"64" 5
"65" 2
"66" 6
"67" 6
"68" 2
"69" 4
"70" 4
"71" 3
"72" 2
"73" 2
"74" 1
"75" 4
"76" 5
"77" 4
"78" 1
"79" 3
"80" 1
"81" 6
"82" 4
"83" 6
"84" 5
"85" 2
"86" 1
"87" 6
"88" 1
"89" 2
"90" 4
"91" 6
"92" 3
"93" 6
"94" 5
"95" 3
"96" 6
"97" 5
"98" 4
"99" 2
"100" 6
"101" 3
"102" 5
"103" 5
"104" 5
"105" 5
"106" 3
"107" 6
"108" 4
"109" 6
"110" 4
"111" 2
"112" 6
"113" 4
"114" 5
"115" 3
"116" 6
"117" 2
"118" 6
"119" 5
"120" 1
2. (2 points)We'll use the data set ants.txt Download ants.txtthat was encountered previously. Assume the data is a simple random sample of ants from a colony. The variables included being
- worker: A classification of two types major and minor worker
- scape: The scape length in microns (one-millionth of a meter), the first antennal segment, articulated to the head via the antennal socket
Is the average scape length in minor workers the same as the one in major workers, or is it different? (Note: Use a 2-sample and 2-tailed z-test to solve this problem)
Hint: Some of our treatment of this data in previous lectures (M7_1) might be useful.
"worker" "scape"
"1" "minor" 1680
"2" "minor" 1730
"3" "minor" 1740
"4" "minor" 1760
"5" "minor" 1750
"6" "minor" 1770
"7" "minor" 1770
"8" "minor" 1790
"9" "minor" 1790
"10" "minor" 1790
"11" "minor" 1800
"12" "minor" 1800
"13" "minor" 1800
"14" "minor" 1810
"15" "minor" 1810
"16" "minor" 1780
"17" "minor" 1780
"18" "minor" 1810
"19" "minor" 1780
"20" "minor" 1820
"21" "minor" 1820
"22" "minor" 1820
"23" "minor" 1800
"24" "minor" 1800
"25" "minor" 1810
"26" "minor" 1790
"27" "minor" 1830
"28" "minor" 1830
"29" "minor" 1830
"30" "minor" 1840
"31" "minor" 1850
"32" "minor" 1860
"33" "minor" 1860
"34" "minor" 1860
"35" "minor" 1870
"36" "minor" 1870
"37" "minor" 1830
"38" "minor" 1830
"39" "minor" 1830
"40" "minor" 1840
"41" "minor" 1840
"42" "minor" 1840
"43" "minor" 1840
"44" "minor" 1840
"45" "minor" 1840
"46" "minor" 1850
"47" "minor" 1850
"48" "minor" 1850
"49" "minor" 1860
"50" "minor" 1860
"51" "minor" 1870
"52" "minor" 1870
"53" "minor" 1870
"54" "minor" 1870
"55" "minor" 1860
"56" "minor" 1830
"57" "minor" 1830
"58" "minor" 1880
"59" "minor" 1880
"60" "minor" 1880
"61" "minor" 1890
"62" "minor" 1890
"63" "minor" 1900
"64" "minor" 1900
"65" "minor" 1900
"66" "minor" 1910
"67" "minor" 1910
"68" "minor" 1910
"69" "minor" 1920
"70" "minor" 1920
"71" "minor" 1880
"72" "minor" 1880
"73" "minor" 1880
"74" "minor" 1880
"75" "minor" 1890
"76" "minor" 1890
"77" "minor" 1890
"78" "minor" 1900
"79" "minor" 1900
"80" "minor" 1900
"81" "minor" 1900
"82" "minor" 1900
"83" "minor" 1910
"84" "minor" 1910
"85" "minor" 1910
"86" "minor" 1920
"87" "minor" 1940
"88" "minor" 1940
"89" "minor" 1950
"90" "minor" 1950
"91" "minor" 1960
"92" "minor" 1960
"93" "minor" 1960
"94" "minor" 1960
"95" "minor" 1970
"96" "minor" 1970
"97" "minor" 1970
"98" "minor" 1970
"99" "minor" 1970
"100" "minor" 1970
"101" "minor" 1930
"102" "minor" 1930
"103" "minor" 1950
"104" "minor" 1960
"105" "minor" 1980
"106" "minor" 1990
"107" "minor" 1990
"108" "minor" 1990
"109" "minor" 2020
"110" "minor" 2020
"111" "minor" 1980
"112" "minor" 1980
"113" "minor" 2030
"114" "minor" 2030
"115" "minor" 2030
"116" "minor" 2040
"117" "minor" 2040
"118" "minor" 2070
"119" "minor" 2070
"120" "minor" 2080
"121" "minor" 2090
"122" "minor" 2090
"123" "minor" 2080
"124" "minor" 2130
"125" "minor" 2130
"126" "major" 2140
"127" "major" 2160
"128" "major" 2170
"129" "major" 2180
"130" "major" 2180
"131" "major" 2190
"132" "major" 2190
"133" "major" 2210
"134" "major" 2220
"135" "major" 2220
"136" "major" 2220
"137" "major" 2270
"138" "major" 2240
"139" "major" 2240
"140" "major" 2240
"141" "major" 2250
"142" "major" 2250
"143" "major" 2250
"144" "major" 2260
"145" "major" 2260
"146" "major" 2270
"147" "major" 2270
"148" "major" 2270
"149" "major" 2270
"150" "major" 2280
"151" "major" 2290
"152" "major" 2290
"153" "major" 2290
"154" "major" 2300
"155" "major" 2300
"156" "major" 2310
"157" "major" 2310
"158" "major" 2320
"159" "major" 2320
"160" "major" 2320
"161" "major" 2320
"162" "major" 2320
"163" "major" 2300
"164" "major" 2330
"165" "major" 2340
"166" "major" 2340
"167" "major" 2340
"168" "major" 2340
"169" "major" 2340
"170" "major" 2340
"171" "major" 2350
"172" "major" 2360
"173" "major" 2360
"174" "major" 2370
"175" "major" 2350
"176" "major" 2370
"177" "major" 2390
"178" "major" 2410
"179" "major" 2470
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started