# Statistical Analysis of Advertising Expenditures and Injury Cases Using R

This statistical analysis uses R to explore the relationship between advertising expenditures and the occurrence of personal injury and workers' compensation cases. This assignment, scrutinizes these associations using hypothesis testing, confidence intervals, prediction intervals, and correlation measures. The results shed light on the significance of advertising expenses in driving injury cases and workers' compensation cases. Additionally, we discuss the implications of our findings in a legal context.

## Problem Statement:

In R Programming assignment, we employ statistical analysis techniques in R to understand the relationship between advertising expenditures and the number of personal injury cases and workers' compensation cases. The primary focus is on testing hypotheses, determining confidence intervals, and interpreting the results.

Solution

In this assignment, we explore statistical analysis techniques to understand the relationship between advertising expenditures and the number of personal injury cases and workers' compensation cases. The primary focus is on testing hypotheses, determining confidence intervals, and interpreting the results.

## Question 5: Testing Hypotheses

For the first part of the assignment, we conduct a hypothesis test to investigate the relationship between advertising expenditures (AdvExp6) and the number of personal injury cases (NewPI) per month. Similarly, we analyze the relationship between AdvExp6 and the number of workers' compensation cases (NewWC) per month. We use t-tests to perform these tests and interpret the results.

Results for Personal Injury Cases (Model1):

• Null Hypothesis: β₁ = 0
• Alternative Hypothesis: β₁ ≠ 0
• Test Statistic: t(40) = 3.315
• p-value: 0.002
• Conclusion: We reject the null hypothesis in favor of the alternative.

Results for Workers' Compensation Cases (Model2):

• Null Hypothesis: β₁' = 0
• Alternative Hypothesis: β₁' ≠ 0
• Test Statistic: t(40) = -0.186
• p-value: 0.853
• Conclusion: We fail to reject the null hypothesis in favor of the alternative.

## Question 6: Relationship Conclusion

Based on the t-tests conducted in question 5, we conclude that there exists a linear relationship between advertising expenditures (AdvExp6) and the number of personal injury cases (NewPI), while such a linear relationship likely doesn't exist for workers' compensation cases (NewWC).

## Question 7: Confidence Intervals

We determine the 95% confidence intervals for the coefficients β₁ and β₁' using the confint function in R. These intervals provide a range for the effect of advertising expenditures on personal injury cases and workers' compensation cases.

• 95% CI for β₁: [0.046, 0.190]
• 95% CI for β₁': [-0.074, 0.062]

## Question 8: Prediction Intervals

In this section, we calculate 95% prediction intervals for the number of personal injury cases (NewPI) for a given advertising expenditure value (AdvExp6 = 170) using the predict.lm function in R.

• 95% Prediction Interval for Model 1: [27.305, 32.520]
• 95% Prediction Interval for Model 2: [30.813, 35.751]

## Question 9: R-squared and Correlation

We compute the R-squared and correlation coefficient for both models, providing insights into the goodness of fit and the strength of the relationship between AdvExp6 and the respective response variables.

• Model 1: R² = 0.2156, Correlation = 0.4643
• Model 2: R² = 0.0009, Correlation = 0.0294

## Question 10: Model Significance

We assess the significance of the models in explaining the variation in the dependent variables. We highlight the explained variance and correlation for both models.

• Model 1: Explains 21.56% of the standard deviation in NewPI, Correlation = 0.4643
• Model 2: Explains 0.09% of the standard deviation in NewWC, Correlation = 0.0294

## Question 11: Conclusion

The final section offers a qualitative interpretation of the data. It suggests that increased advertising expenditures are associated with more personal injury cases but not with workers' compensation cases. This has implications in a legal context, highlighting the importance of understanding causation and correlation.