For this question, you will have to create a small data set based on the table b
ID: 3235414 • Letter: F
Question
For this question, you will have to create a small data set based on the table below and load it in R.
Caretakers, a local nonprofit organization, operates the concession stands for the Newland baseball Park, home of the Newland Nuggets (a minor league baseball team). Doing so permits Caretakers to raise funds to operate its soup kitchen. Caretakers is concerned with waste in the concessions area: too many pre-cooked hot dogs are left over after a game. Heinz Canine, their research analyst, feels that hot dog consumption can be predicted by the number of advance sale tickets purchased for a game (attendance is usually approximately twice the advance sales). Heinz gathers the accompanying data for a sample of 10 days.
This is the data he collected:
Advance Ticket Sales
Hot Dog Sales
247
503
317
691
1247
2638
784
1347
247
602
1106
2493
1749
3502
875
2100
963
1947
415
927
a) Create a .csv file based on this table, and load into R
b) Run a linear regression with hot dog sales as a dependent variable, and number of advance sales as an independent variable.
c) Provide your code and results
d) Based on your results, predict how many hot dogs will be sold if 1,000 advance tickets are sold.
e) What other variables should H. Canine consider including in his regression model, in order to increase its predictive ability?
Advance Ticket Sales
Hot Dog Sales
247
503
317
691
1247
2638
784
1347
247
602
1106
2493
1749
3502
875
2100
963
1947
415
927
Explanation / Answer
Sol:
hot dog sales as a dependent variable ----->Y
, and number of advance sales as an independent variable. ----->X
read data:
using read.csv in R
DOGSDATA1 <- read_csv("~/DOGSDATA1.csv")
fit <- lm(HotDogSales ~ AdvanceTicketSales, data=DOGSDATA1)
summary(fit)
Solutionc:
output:
Call:
lm(formula = HotDogSales ~ AdvanceTicketSales, data = DOGSDATA1)
Residuals:
Min 1Q Median 3Q Max
-305.693 -66.693 3.991 44.354 262.764
Coefficients:
Estimate Std. Error t value
(Intercept) 62.7796 103.3121 0.608
AdvanceTicketSales 2.0280 0.1118 18.140
Pr(>|t|)
(Intercept) 0.56
AdvanceTicketSales 8.76e-08 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 166.6 on 8 degrees of freedom
Multiple R-squared: 0.9763, Adjusted R-squared: 0.9733
F-statistic: 329 on 1 and 8 DF, p-value: 8.763e-08
regression eq from output is
hotdogsales=62.7796+2.0280(advanceticketsales)
slope=2.0280
y intercept--62,7796
r sq=0.9763
r sq is called coeff of determination
97.63% variation in hotdogsales is explained by model .
good model
Solutiond:
how many hot dogs will be sold if 1,000 advance tickets are sold.
put advance tickets are sold.=1000
substitte in the regression eq obtained
hotdogsales=62.7796+2.0280(advanceticketsales)
==62.7796+2.0280(1000)
=2090.77
=2091(rounding to nearest integer)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.