Solved-Homework 2- (Data Analysis Using R)- Solution

$35.00 $24.00

Instructions: 1. Copy your answer to each question AND the R code by which you reached your answer to a document. The answers should be correctly ordered. Problem 1 (2.5 pts): Consider data set infert, which is available in R. It is a data frame consists of eleven variables including education, the years of education,…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

Instructions:

1. Copy your answer to each question AND the R code by which you reached your answer to a document. The answers should be correctly ordered.

Problem 1 (2.5 pts): Consider data set infert, which is available in R. It is a data frame consists of eleven variables including education, the years of education, and age, the age in years when participated.

1. (0.5 pt) What is the type of this education variable?

2. (1 pt) What is the graph appropriate for education? Please provide such plot to visualize education.

3. (1 pt) Please get the mean age for each level of education.

Problem 2 (4 pts): Consider data set mtcars, which is available in R. It is a data frame consists of eleven variables including carb, the number of carburetors, mpg, miles per gallon, hp, horse power, and am type of transmission (0 = automatic, 1 = manual).

1. (0.5 pt) What is the type of this carb variable?

2. (1 pt) What is the graph appropriate for carb? Please provide such plot to visualize carb.

3. (0.5 pt) What are the types of mpg variable and am variable?

4. (1 pt) What is the graph appropriate to see the relationship between am and mpg? Please provide such plot and your interpretation of the result.

5. (1 pt) Find which observation is an outlier in hp and use the concept we learned in class to justify that is an outlier.

Problem 3 (2 pts): Let’s say you are playing an altered version of Craps. It is a gambling game that uses two dice, and the sum of two rolled dice determines the outcome. If the sum is 2, 3, or 12, you lose everything. If the sum is 7 or 11, then you earn the same amount as your bet. If the sum is 4, 5, 6, 8, 9, or 10, then you lose half of your bet.

1. (1 pt) Ceate a Probability Mass Function (PMF) of the variable X = the pro t from the game, assuming that you bet $30 for the game.

2. (1 pt) What is the expected value of X?

1

Problem 4 (1.5 pts): An M&M packet says that it’s weight is 47.9g, but when you buy M&M packets, the actual weights vary. Suppose the weight of M&M packet follows a normal distribution with mean of 47.9g and standard deviation of 1.2g.

1. (0.5 pt) Let’s say that the company declares that the packet is ‘defective’ if its weight is less than 45g. What is the probability of getting a defective packet?

2. (0.5 pt) Which weight represents 80th percentile?

3. (0.5 pt) You wanted to have some chocolate and went out to buy a M&M packet. You got lucky and it weighed 49.5g. What is the standardized score for this weight?

2