Midterm
Midterm
Morgan Holland
5/22/2020
Instructions
You will need alcohol. RData dataset to complete the Midterm.
The dataset includes data on 9,822 individuals. Each individual report various demographic and health characteristics, as well as a variable that equals 1 if the person reports abusing alcohol.
Question 1.
Load the alcohol.RData dataset. Convert it to a table named alcohol. Use print(head(alcohol)) to show me the first six rows of the dataset. Copy and paste your code and output into the answer box.
Print(head(alcohol))
Question 2
unemrate is the unemployment rate in a respondents State. At what level of measurement is this variable? (Nominal Scale, Ordinal Scale, Interval Scale, or Ratio Scale)?
Ratio scale since it has a defined zero point.
Question 3-6
The famsize variable measures how many people are in the respondents family. Fill in the missing values in the following relative frequency table:
Family Size Number of Respondents Relative Frequency Cumulative Relative Frequency
1 2595 0.264 0.264
2 2311 0.235 0.499
3 1766 0.180 0.679
4 2000 0.204 0.883
5 740 0.075 0.958
6 257 0.026 0.984
7 99 0.010 0.995
8 32 0.003 0.998
9 9 0.001 0.999
10 6 0.001 0.999
11 5 0.001 1.000
12 1 0.000 1.000
13 1 0.000 1.000
Total number of respondents = 9822
Family size 2: 2311/9822 = 0.235
Family size 4: 2000/9822 = 0.204
Cumulative Relative Frequency Family size 3: 0.499+0.180 = 0.679
Cumulative Relative Frequen
cy Family size 3: 0.679+0.204 = 0.883
Question 7-8f
Create a barplot of the famsize variable Copy and paste your code in the answer box. In the next question, upload your barplot.
# Simple Bar Plotcounts <- table(mtfamily$size)barplot (counts, main=Number of Respondents, xlab=Family Size Question 9 Does family size appear to be right-skewed, left-skewed, or not skewed at all? Family size appears to be left-skewed Question 10-11 educ is the respondents level of education, in years. Calculate the sample mean and sample standard deviation of educ. Sample mean = average (E2:E9823) = 13.30961 Sample standard deviation =std. s (E2:E9823) = 2.898751 Question 12 Suppose we assume that unemrate is normally distributed with mean 5.57% and standard deviation 1.51%. What is the probability of picking a person at random who faces an unemployment rate less than 4%? µ = 0.0557 and ? = 0.0151 P(x<0.04) = P(x-µ<0.04-0.0557) = P (x-µ?<0.04-0.05570.0151)0.04-0.05570.0151= -1.04P(z<-1.04) = 0.1492 Question 13 What is the probability of picking a person who faces an unemployment rate greater than 7%, assuming the unemployment rate is normally distributed as in question 12? µ = 0.0557 and ? = 0.0151 P(x>0.07) = P(x-µ>0.07-0.0557) = P (x-µ?>0.07-0.05570.0151)0.07-0.05570.0151= 0.95P(z>0.95) = 0.1711
Question 14
What is the 98th percentile of unemrate, assuming it is normally distributed as in question 8?
0.98 to z score
Percentile to z score
P(z