Use the following commands to install the `marketing` dataset
and load the `datarium` package into your session.
```{r}
#install.packages("datarium")
library(datarium)
data("marketing", package = "datarium")
str(marketing)
Use the regression line to predict the `Sales` amount when `newspaper` budget is `$136.80K` and `facebook` is `$43.92K`.
This should be done in Rstudio 3.6.1
R script
install.packages("datarium")
library(datarium)
data("marketing", package = "datarium")
str(marketing)
y=marketing$sales
x1=marketing$facebook #taken facebook and newspaper only since
youtube is not mentioned in question
x2=marketing$newspaper
p=lm(y~x1+x2)
p
result:
predicted model:
y=11.026705+0.199045* x1+0.006644* x2
Sales` amount when `newspaper` budget is `$136.80K` and `facebook` is $43.92K`
=11.026705+0.199045*$43.92K+0.006644* $136.80K
=$20.67766K
sales=$20.67766K
Get Answers For Free
Most questions answered within 1 hours.