A.

The dependent variable (y) in this case is the quantity of products being ordered (order_details\(quantity), and the independent variable (x) is the discount percentage applied to the price per unit (order_details\)discount).

The estimating equation for the simple linear regression model is:

quantity = \(\beta_0\) + \(\beta_1\) * discount

B.

order_details <- read.csv("order_details.csv")
# Load the dataset (assuming it is already loaded)

# Assign the variables to y and x
y <- order_details$quantity
x <- order_details$discount

# Fit the linear regression model
model <- lm(y ~ x, data = order_details)
model
## 
## Call:
## lm(formula = y ~ x, data = order_details)
## 
## Coefficients:
## (Intercept)            x  
##       22.17        29.31

C.

summary(model)
## 
## Call:
## lm(formula = y ~ x, data = order_details)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -27.494 -12.167  -4.167   7.833 107.833 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   22.167      0.490  45.240  < 2e-16 ***
## x             29.308      4.872   6.016  2.1e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.87 on 2153 degrees of freedom
## Multiple R-squared:  0.01653,    Adjusted R-squared:  0.01608 
## F-statistic: 36.19 on 1 and 2153 DF,  p-value: 2.096e-09

The slope coefficient is estimated to be 29.308. This indicates that for a one-unit increase in the independent variable (discount), the dependent variable (quantity) is estimated to increase by approximately 29.308 units, on average.

The intercept coefficient is estimated to be 22.167. This represents the estimated value of the dependent variable (quantity) when the independent variable (discount) is zero. In this context, it suggests that when no discount is applied, the average quantity of products ordered is estimated to be 22.167 units.

In summary, the slope coefficient indicates the change in quantity for each unit change in discount, while the intercept coefficient represents the estimated quantity when the discount is zero.

D.

# Calculate the slope and intercept manually
slope <- cov(x, y) / var(x)
intercept <- mean(y) - slope * mean(x)
slope
## [1] 29.30836
intercept
## [1] 22.16683