Instructions: you first must install the Ecdat package with the command. What code did you use to
Question:
Instructions: you first must install the Ecdat package with the command. What code did you use to answer the questions?
install.packages("Ecdat")
library(Ecdat)
head(Cigarette)
Questions
1. 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?
2. 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?
3. Create a scatter plot of price per pack vs number of packs per capita for all states and years?
4. Are the price and the per capita packs positively correlated, negatively correlated, or uncorrelated? Explain why your answer would be expected?
5. 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?
How did you get the code for these questions?
Introduction to Financial Accounting
ISBN: 978-0133251036
11th edition
Authors: Charles Horngren, Gary Sundem, John Elliott, Donna Philbrick