I need a R Programmer

Job ID: 34254861

Budget: $15 – $25 USD

you will use the Cigarette data set in the Ecdat package. To do this, you first must install the Ecdat package with the command

install.packages("Ecdat")

To make this package accessible to your R session, type the command

library(Ecdat)

You should now be able to see the Cigarette data frame:

head(Cigarette)

QUESTIONS:
Create a boxplot of the average number of packs per capita by state. Which states have the highest number of packs? Which have the lowest?

Find the median over all the states of the number of packs per capita for each year. Plot this median value for the years from 1985 to 1995. What can you say about cigarette usage in these years?

Create a scatter plot of price per pack vs number of packs per capita for all states and years.

Are the price and the per capita packs positively correlated, negatively correlated, or uncorrelated? Explain why your answer would be expected.

Change your scatter plot to show the points for each year in a different color. Does the relationship between the two variable change over time?

Do a linear regression for these two variables. How much variability does the line explain?

The plot above does not adjust for inflation. You can adjust the price of a pack of cigarettes for inflation by dividing the avgprs variable by the cpi variable. Create an adjusted price for each row, then re-do your scatter plot and linear regression using this adjusted price.

Create a data frame with just the rows from 1985. Create a second data frame with just the rows from 1995. Then, from each of these data frames, get a vector of the number of packs per capita. Use a paired t-test to see if the number of packs per capita in 1995 was significantly different than the number of packs per capita in 1985.

In the process of doing this project, have any questions come to mind that this data set could answer? If so, pick one and do the analysis to find the answer to your question.

NEED CODE ONLY