Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# Please complete this for me in R studio using the code described in https://nulib.github.io/kuyper-stat202/

1 answer below Â»
LAB 1
Due date: Mon 02/26/24 by end of day.
Instructions: You are required to work individually. Use R Markdown and Knit to render a pdf or a word document. Upload the document back in Brightspace.
Reference: For this lab, we will be using the â€œOpenIntro Statistics: Labs for R" (by Andrew Bray et al), available under a Creative Commons Attribution-ShareAlike license, in the link below:
https:
nulib.github.io/kuyper-stat202
Structure: Lab contains 2 mandatory sections (Section 1 and Section 2) outlined below.
Section 1: This is just a practice (warm up) section (no need to submit Section 1).
Practice with R Studio by mimicking all the syntax given in Chapter 8- Introduction to Linear Regression (sec 8.1, 8.2, 8.3, 8.4).
Section 2: On Your Own (Submission required).
This section builds on Section 1 and it requires you to answer the following questions posed in sec 8.7 in Chapter 8 (Intro to Linear Regression) in â€œOpenIntro Statistics: Labs for R" (by Andrew Bray et al). Mark each question clearly using # and interpret the results.
1. Choose another traditional variable fromÂ mlb11Â that you think might be a good predictor ofÂ runs. Produce a scatterplot of the two variables and fit a linear model. At a glance, does there seem to be a linear relationship?
2. How does this relationship compare to the relationship betweenÂ runsÂ andÂ at_bats? Use the R22Â values from the two model summaries to compare. Does your variable seem to predictÂ runsÂ better thanÂ at_bats? How can you tell?
3. Now that you can summarize the linear relationship between two variables, investigate the relationships betweenÂ runsÂ and each of the other five traditional variables. Which variable best predictsÂ runs? Support your conclusion using the graphical and numerical methods weâ€™ve discussed (for the sake of conciseness, only include output for the best variable, not all five).
4. Now examine the three newer variables. These are the statistics used by the author ofÂ MoneyballÂ to predict a teams success. In general, are they more or less effective at predicting runs that the old variables? Explain using appropriate graphical and numerical evidence. Of all ten variables weâ€™ve analyzed, which seems to be the best predictor ofÂ runs? Using the limited (or not so limited) information you know about these baseball statistics, does your result make sense?
5. Check the model assumptions for the regression model with the variable you decided was the best predictor for runs.
Answered Same Day Feb 26, 2024

## Solution

Pratibha answered on Feb 26 2024
MLB11 Regression Analysis
Name of the student
University Name
Question1. Choose another traditional variable fromÂ mlb11Â that you think might be a good predictor ofÂ runs. Produce a scatterplot of the two variables and fit a linear model. At a glance, does there seem to be a linear relationship?
www.openintro.org/stat/data/mlb11.RData", destfile = "mlb11.RData")
Dataset has 30 observations with 12 variables. Variables are as follows: "team" ,"runs" ,"at_bats","hits" , "homeruns", "bat_avg", "strikeouts" , "stolen_bases", "wins", "new_onbase", "new_slug" ,"new_obs" .
The linear model for the relationship between runs and hits is given by:
Runs=âˆ’375.5600+0.7589Ã—Hits
An interpretation of the summary results are:
Intercept: The estimated intercept is -375.5600. It represents the estimated runs when the hits are zero. However, in the context of baseball, zero hits wouldn't make sense, so the intercept might not have a practical interpretation.
Coefficient for Hits: The estimated coefficient for hits is 0.7589. This means, on average, for each additional hit, the runs increase by 0.7589. This coefficient is statistically significant (p-value < 0.05), suggesting that hits is a significant predictor of runs.
R-squared: The R2 value is 0.6419, indicating that approximately 64.19% of the variability in runs can be explained by the linear relationship with hits.
F-statistic: The F-statistic tests the overall significance of the model. The p-value (1.043e-07) is less than 0.05, suggesting that the model is significant.
Residuals: The residuals (differences between observed and predicted values) have a mean close to zero, indicating that, on average, the model predicts well.
Scatterplot: The scatterplot with the fitted line suggests a positive linear relationship between hits and runs. As the number of hits increases, the runs also tend to increase.
In conclusion, based on the linear model and the scatterplot, there seems to be a positive linear relationship between hits and runs in the mlb11 dataset. The model is statistically significant, and hits can be considered a good predictor of runs.
Question2. How does this relationship compare to the relationship betweenÂ runsÂ andÂ at_bats? Use the R22Â values from the two model summaries to compare. Does your variable seem to predictÂ runsÂ better thanÂ at_bats? How can you tell?
The R-squared values for the two models are as follows:
Â· R-square value for the model with hits: 0.6419
Â· R-square value for the model with at_bats: 0.3729
The R-square value is a measure of how well the independent variable(s) explain the variability in the dependent variable. In this context, it represents the proportion of variability in runs that can be explained by hits (or at_bats).
Comparing the R-square values:
The model with hits (R2=0.6419) has a higher R2 value compared to the model with at_bats (R2=0.3729).
A higher R2 value indicates that a larger proportion of the variability in runs is explained by the model.
Therefore, based on the...
SOLUTION.PDF