Question

In: Statistics and Probability

Please do these questions in the R language 1. Load the cars dataset into R. It...

Please do these questions in the R language

1. Load the cars dataset into R. It is a built-in dataset.

2. Do an str() to determine the number of observations and variables. Enter your answer as a comment.

3. Plot speed on x axis and distance on y axis.

4. Find the correlation between speed and distance. What does the magnitude and sign indicate? Enter your answer as a comment.

5. Build a linear regression model with speed as the independent variable and distance as the dependent variable (all raised to first power).

6. Write the regression equation from question 5 as a comment.

7. Interpret the intercept and slope coefficients from question 6 in your own words as a comment.

8. What is the R square value of the regression model from question 5? What is the definition of R square value in the context of this question? Write your answer as a comment.

9. Are the coefficients significant at 0.001 level of significance for the regression model from question 5? How do you determine that? Enter your answer as a comment.

10. What is the distance value for a speed of 25 units using the regression equation from question 6? You can calculate it by hand. Enter your answer as a comment.

Solutions

Expert Solution


Related Solutions

R Problem Set: #Work with the inbuilt dataset "Cars" View(cars) This will show you the dataset...
R Problem Set: #Work with the inbuilt dataset "Cars" View(cars) This will show you the dataset on 2 variables speed and distance. ?cars This will explain what the variables mean. #Q1) Describe the dataset. What are the main findings? #Q2) Design a relevant question to model using linear regressions #Q3) Run the regression and report the std error, t-stat, p value and f stat. #Q4) Is this a valid regression? Is the normality assumption justified? Show clearly. #Q5) Are there...
Install and load the dataset named Carseats (in the ISLR package) into R. Run a multiple...
Install and load the dataset named Carseats (in the ISLR package) into R. Run a multiple linear regression with all the variables. Using the coefficients, write down the model. ( be careful with the qualitative variable ShelveLoc. ) obtain the interaction plot of ShelveLoc and price.
Install and load the dataset named Carseats (in the ISLR package) into R. Create a new...
Install and load the dataset named Carseats (in the ISLR package) into R. Create a new dataframe that is a copy of Carseats. Create two indicator (dummy) variables: Bad_Shelf = 1 if ShelveLoc = “Bad”, 0 otherwise Good_Shelf = 1 if ShelveLoc = “Good”, 0 otherwise Also, create two interaction variables: Price_Bad_Shelf = Price* Bad_Shelf Price_Good_Shelf = Price* Good_Shelf For Questions 1-2, please estimate a linear regression model (using the lm function) with Sales as the dependent variable and Price,...
R code: ## 2. __Basic dplyr exercises__ ## Install the package `fueleconomy` and load the dataset...
R code: ## 2. __Basic dplyr exercises__ ## Install the package `fueleconomy` and load the dataset `vehicles`. Answer the following questions. install.packages("fueleconomy") library(fueleconomy) library(dplyr) library(tidyr) data(vehicles) e. Finally, for the years 1994, 1999, 2004, 2009, and 2014, find the average city mpg of midsize cars for each manufacturer for each year. Use tidyr to transform the resulting output so each manufacturer has one row, and five columns (a column for each year). I have included sample output for the first...
Write code in R for this questions,, will vote!! Load the Taxi.txt data set into R....
Write code in R for this questions,, will vote!! Load the Taxi.txt data set into R. (a) Calculate the mean, median, standard deviation, 30th percentile, and 65th percentile for Mileage and TripTime. (b) Make a frequency table for PaymentProvider that includes a Sum column. Report the resulting table. (c) Make a contingency table comparing PaymentType and Airport. Report the resulting table. (d) Use the cor() function to find the correlation between each pair of the Meter, Tip, Mileage, and TripTime...
What are the R codes for these questions below: 1. Load the library {car}, which contains...
What are the R codes for these questions below: 1. Load the library {car}, which contains the Salaries data set. #Then, list the first few records with head(Salaries). The display the summmary() for this dataset, which will shows frequencies. Then, load the library {psych} which contains the describe() function and use this function to list the descriptive statistics for the dataset. 2. Load the coefplot library and display a coefficient plot for lm.fit.2 <- lm(salary~sex+yrs.since.phd, data=Salaries) using the coefplot() function....
What are the R codes for these questions below: 1. Load the library {car}, which contains...
What are the R codes for these questions below: 1. Load the library {car}, which contains the Salaries data set. #Then, list the first few records with head(Salaries). The display the summmary() for this dataset, which will shows frequencies. Then, load the library {psych} which contains the describe() function and use this function to list the descriptive statistics for the dataset. 2. Load the coefplot library and display a coefficient plot for lm.fit.2 <- lm(salary~sex+yrs.since.phd, data=Salaries) using the coefplot() function....
Load the USArrests sample dataset from the built-in datasets (data(USArrests)) into R using a dataframe (Note:...
Load the USArrests sample dataset from the built-in datasets (data(USArrests)) into R using a dataframe (Note: Row names are states, not numerical values!). Use the kmeans package to perform a clustering of the data with increasing values of k from 2 to 10 - you will need to decide whether or not to center/scale the observations - justify your choice. Plot the within-cluster sum of squares for each value of k - what is the optimal number of clusters? Use...
Use the “d_logret_6stocks” dataset to answer the questions. (General Motor: GenMotor)(using R) (1) Regress the return...
Use the “d_logret_6stocks” dataset to answer the questions. (General Motor: GenMotor)(using R) (1) Regress the return of General Motor on the returns of Citigroup with intercept and without intercept, respectively. Report the estimated coefficients. (2) Generate an ANOVA table to conclude if regression effects are significant. (3) Compute the correlation of General Motor and Citigroup, and test if their correlation is zero. (4) Test if the proportion of returns of Citigroup greater than Pfizer is 0.6. dataset below Date   Pfizer  ...
Solve it by R Use the “d_logret_6stocks” dataset to answer the questions. Test by using α=...
Solve it by R Use the “d_logret_6stocks” dataset to answer the questions. Test by using α= .01. (General Motor: GenMotor). (1) Regress the return of General Motor on the returns of Citigroup (with intercept). Report the estimated coefficients. Is there any evidence to show strong linear relationship between these two variables at significance level 5%? (2) Suppose we “know” the return of Citigroup tomorrow is 0.05, what is the predicted return of General Motor tomorrow? (3) Compute the correlation of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT