0% found this document useful (0 votes)
12 views4 pages

Regression Analysis of Toy Sales Data

The document outlines an experiment on regression analysis conducted by a student at Vishwakarma Institute of Technology, focusing on constructing simple and multiple linear regression models using a Toy Sales dataset in R. The results indicate that the R-squared value for simple linear regression is 0.619, while for multiple linear regression it is 0.8588, suggesting that multiple variables provide a better fit. The conclusion emphasizes the importance of checking assumptions in regression analysis and identifies scenario a as the optimal choice for maximizing unit sales.

Uploaded by

Swaroop Deokar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Regression Analysis of Toy Sales Data

The document outlines an experiment on regression analysis conducted by a student at Vishwakarma Institute of Technology, focusing on constructing simple and multiple linear regression models using a Toy Sales dataset in R. The results indicate that the R-squared value for simple linear regression is 0.619, while for multiple linear regression it is 0.8588, suggesting that multiple variables provide a better fit. The conclusion emphasizes the importance of checking assumptions in regression analysis and identifies scenario a as the optimal choice for maximizing unit sales.

Uploaded by

Swaroop Deokar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Bansilal RamnathAgarwal Charitable Trust’s

VISHWAKARMA INSTITUTE OF TECHNOLOGY – PUNE


Department of Multidisciplinary Engineering

MD2201: Data Science


Name of the student: Swaroop Deokar Roll No. 16

Div: CS-AIML-A Batch: 1

Date of performance: 17/08/2023

Experiment No.4

Title: Regression .

Aim: i. To construct a simple linear regression model


ii. To construct a multiple linear regression model.

Software used: Programming language R.

Data Set: Toy Sales Dataset

Code Statement:
1. Simple Linear Regression
i. Consider the Toy sales data set.
ii. Apply simple linear model considering response as Unit sales and explanatory variable
as Price.
iii. Plot the scatter plot and draw the regression.
iv. What are values of R-square and residual standard error? (Write in conclusion)
v. Display all predicted values from the designed model and the corresponding values of
error.
2. Multiple Linear regression:
i. Consider Toy sales data set.
ii. Consider all variables to fit the regression model.
iii. Compare the R-square of SLR with MLR. (Write in conclusion)
iv. Which of the variable is more significant? Why? (Write in conclusion)
v. Can you reject Null hypothesis for promotion expenditure variable? (Write in conclusion)
vi. Which scenario from the following you will select to be applied to get maximum
number of Unit sales? (Write in conclusion)
a. Price=9.1$, Adexp=52,000$, Promexp=61,000$
b. Price=8.1$, Adexp=50,000$,Promexp=60,000$

Code: #SLR----
f1=[Link]("Toy_sales_csv.csv")
#print(f1)
l1=lm(Unitsales~Price,f1)
s1=summary(l1)
print(s1)
library(ggplot2)
Bansilal RamnathAgarwal Charitable Trust’s
VISHWAKARMA INSTITUTE OF TECHNOLOGY – PUNE
Department of Multidisciplinary Engineering

p=ggplot(f1,aes(Price,Unitsales))+geom_point()+geom_smooth(method=lm,formula =
y~x,col="red",se=F)
print(p)

pred1=predict(l1)
cat("\nPredicted value\n",pred1)
err<-f1$Unitsales-pred1
cat("\n\nErrors",err)

#MLR----
l2=lm(Unitsales~Price+Adexp+Promexp,f1)
s2=summary(l2)
print(s2)

df=[Link](Price=c(9.1,8.1),Adexp=c(52,50),Promexp=c(61,60))
pred2=predict(l2,df)
cat("\nPredicted value\n",pred2)

Results:
Bansilal RamnathAgarwal Charitable Trust’s
VISHWAKARMA INSTITUTE OF TECHNOLOGY – PUNE
Department of Multidisciplinary Engineering

Conclusion: In conclusion constructing a simple linear regression model involves visually observing a
linear pattern in the scatterplot and a statistically significant correlation between the independent and
dependent variables. It is important to check the assumptions for linear regression, including linearity,
independence of observations, normality and homogeneity of variance. On the other hand constructing a
multiple linear regression model involves analyzing the relationship between a dependent variable and
two or more independent variables. It is important to consider the assumptions and limitations of linear
regression analysis, as well as the potential pitfalls that may arise. By following these guidelines and
interpreting the results appropriately, linear regression can be a useful tool for predicting trends and
estimating values of variables.

1) Simple Linear Regression


The value of R-squared for LSR is 0.619
Residual standard error is 1997

2) Multiple Linear Regression


a) The value of R-Squared for SLR is 0.619 while that for MLR is 0.8588
Bansilal RamnathAgarwal Charitable Trust’s
VISHWAKARMA INSTITUTE OF TECHNOLOGY – PUNE
Department of Multidisciplinary Engineering

b) Multiple R-Squared variable is more significant having a higher value. Higher value
implies that more changes in independent variables corelates to shifts in dependent variable.
c) Yes, the Null hypothesis will be rejected as the pvalue is less than 0.05
d) Scenario a will be selected with price 9.1$

Common questions

Powered by AI

Selecting a price of $9.1 potentially results in maximum unit sales according to the regression model's predictions for the given scenarios. This conclusion is based on the predicted values calculated from the Multiple Linear Regression model, which takes into account all relevant factors, including price, ad expenditure, and promotional expenditure. The scenario with a price of $9.1, ad expenditure of $52,000, and promotional expenditure of $61,000 yields the most favorable outcome in terms of sales predictions, highlighting the interplay between these economic factors in optimizing sales .

In the context of fitting a Multiple Linear Regression model to the Toy sales data, the variable identified as the most significant is the one that contributes the most explanatory power to the model. The problem statement suggests that the variable with the highest contribution to the R-squared value in the MLR model would be significant. Since the MLR has a significantly higher R-squared value than the SLR model, which only considers price, all included variables (price, ad expenditure, and promotional expenditure) contribute to this significance. Specific significance per variable would depend on individual statistical results like p-values, where a variable with a p-value less than 0.05 would be deemed significant .

The choice of variables significantly affects the outcome of a Multiple Linear Regression model for predicting Toy sales as it determines the model's ability to accurately describe the relationship between the independent variables and the dependent variable. In this context, including variables like price, ad expenditure, and promotional expenditure not only increases the model's ability to explain the variance in unit sales, as shown by a higher R-squared value of 0.8588 compared to SLR's 0.619, but also affects the prediction accuracy and generalization of the model to unseen data. A comprehensive selection of variables can lead to a more robust model .

The residual standard error is a measure of the quality of a regression model. It represents the average distance that the observed values fall from the regression line. In the context of Simple Linear Regression for the Toy sales data, the residual standard error is 1997. A lower residual standard error would indicate that the model predictions are closer to the actual observed data, suggesting higher accuracy. In this case, a residual standard error of 1997 implies a moderate level of prediction accuracy .

The R-squared value is a statistical measure that explains the proportion of variance for the dependent variable that's explained by the independent variable(s) in a regression model. When comparing SLR and MLR for the Toy sales dataset, the R-squared value for SLR is 0.619, meaning approximately 61.9% of the variance in unit sales is explained by price alone. In contrast, the MLR model has an R-squared value of 0.8588, indicating that about 85.88% of the variance in unit sales is explained when considering price, ad expenditure, and promotional expenditure as factors . This shows that MLR provides a better fit by explaining more variance than SLR.

Visualizing data through scatter plots plays a crucial role in regression analysis as it allows for the visual inspection of the relationship between variables. In the context of the Toy sales dataset, creating a scatter plot helps in identifying the linearity of the relationship between unit sales and price, which is a fundamental assumption of linear regression models. It also aids in detecting outliers and the possible need to transform variables to meet assumptions like normality. By visually confirming a linear pattern, analysts can confidently proceed with fitting a simple linear regression model .

When constructing a Simple Linear Regression model, the key assumptions that need to be checked include linearity, independence of observations, normality, and homogeneity of variance. Linearity assumes that there is a straight-line relationship between the dependent and independent variables. Independence of observations means that the residuals (errors) should be uncorrelated across different observations. Normality implies that the residuals of the model are normally distributed. Homogeneity of variance means that the residuals should have a constant variance across all levels of the independent variable. These assumptions are important because violations can lead to incorrect conclusions about the relationships between variables and affect the validity and reliability of the model's predictions .

Interpreting the results of a regression analysis appropriately is essential because it affects decision-making and policy recommendations based on the dataset analyzed. Correct interpretation ensures the validity of insights derived about relationships between variables, such as causation versus correlation, and the practical significance of each predictor. Potential issues from incorrect interpretation can include making erroneous business decisions, such as allocating resources based on flawed predictions, or misidentifying the importance of variables, leading to misguided strategy development. Additionally, incorrect interpretation could lead to assumptions about model reliability that are not supported by the data, potentially resulting in lost opportunities or resource misallocation .

The potential benefits of using Simple Linear Regression (SLR) include its simplicity and ease of interpretation, making it suitable when exploring the relationship between two variables. It requires fewer data points and variables, making it computationally less intensive. However, the main pitfall is its lack of ability to account for additional factors influencing the dependent variable, which may lead to biased estimates if important variables are omitted. Multiple Linear Regression (MLR), on the other hand, takes into account multiple factors, improving explanatory power and providing a more comprehensive understanding of the data, as seen in the R-squared improvement to 0.8588 from 0.619 for SLR. However, it requires careful handling of multicollinearity, larger datasets, and more complex interpretation .

The null hypothesis can be rejected for the promotion expenditure variable in the context of MLR analysis of Toy sales data if the p-value associated with the promotion expenditure coefficient is less than 0.05. The analysis indicates that the null hypothesis is rejected because this condition is met, suggesting that promotion expenditure has a statistically significant impact on the unit sales .

You might also like