Question

Use the built in R dataset called “mtcars.” You can see what variables this dataset contains...

  1. Use the built in R dataset called “mtcars.” You can see what variables this dataset contains by typing help(mtcars). Calculate a scatter plot for the variables: wt and mpg. Also, calculate the correlation coefficient. Calculate a least squares line and plot it in the scatterplot.

Homework Answers

Answer #1

I have attached the code below as well as the output.

data=mtcars help(data) x=data$wt y=data$mpg plot(x,y) cor(x,y) model=lm(y~x) yest=37.285-5.344*x plot(x,y) lines(x,yest,type="l")

The scatter plot is as follows:

where my x variate corresponds to weight and y variate corresponds of mpg.

To find correlation between them cor command is used and output is:

cor(x,y)
[1] -0.8676594

hence the correlation is -0.8676594.

The least square estimates are as follows

Coefficients:
(Intercept) x
37.285 -5.344

Hence the model is

Yest=37.285-5.344*X

Therefore the least squares line is calculated and the graph is as follows

Hence the line is the least square line and the points are scatterplot.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
3. The R-built in dataset called beaver2 (try ?beaver2) contains the variables temp (body temperature in...
3. The R-built in dataset called beaver2 (try ?beaver2) contains the variables temp (body temperature in °Celsius) and active (0 = inactive, 1 = active outside its retreat). Answers should be in the form of R code on how to accomplish each part and include the correct statistical explanation for those that require it in the question. The significance level for alpha =0.05. Please be as thorough as possible and please submit written explanations(no pictures). Thank you so much!!! a....
You have five quantitative variables and two categorical variables in a dataset. You would like to...
You have five quantitative variables and two categorical variables in a dataset. You would like to examine the pairwise relationship between all variables in the dataset. A) What kind of plots or tables are you going to use and why? B) How many unique correlation coefficients r are you expecting to calculate? Show your reasoning/calculations.
You have five quantitative variables and two categorical variables in a dataset. You would like to...
You have five quantitative variables and two categorical variables in a dataset. You would like to examine the pairwise relationship between all variables in the dataset. A) What kind of plots or tables are you going to use and why? B) How many unique correlation coefficients r are you expecting to calculate? Show your reasoning/calculations. (harder question)
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains...
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains daily closing stock prices for Google and Amazon from 8/22/2017 to 8/22/2018. When we examine stock prices (or other financial assets) we often transform them into a (simple) return series. The return series are computed by the formula: (present price/past price) - 1. The dataset contains both stock prices and return series. 1. Using R, construct time series (line) plots for both stock prices...
Use the classroom dataset. A researcher wants to be able to use shoe size to predict...
Use the classroom dataset. A researcher wants to be able to use shoe size to predict height. Shoe size= 6, 9, 7.5, 9.5, 8, 10.5, 8, 8, 7.5, 7.5, 9, 9, 8.5, 11.5, 8.5, 9, 7, 5, 8, 8, 8.5, 6.5, 6 Height(in)= 62, 67, 62, 69, 63, 67, 66, 63, 68, 64, 63, 66, 65, 72, 64, 65, 66, 61, 67, 64, 65, 60, 64 A) what variable is the response variable and which is the predictor variable? B)...
In linear regression, the independent variable is called the a. Response Variable b. The explanatory variable...
In linear regression, the independent variable is called the a. Response Variable b. The explanatory variable c. The extrapolted variable d. an outlier A graph that will help to one to see what type of curve might best fit the bivariate data a. Pie chart b. stem-leaf plot c. dot plot d. scatter plot The technique of extending a regression line beyond the region of the actual data a. Least Squares Regression b. Variability c. Extrapolation d. Residual analysis The...
in R language, how would you use mutate() to make a new column in the dataset...
in R language, how would you use mutate() to make a new column in the dataset called moisture100 which contains the moisture score times 100 I wrote coffee_ratings %>% mutate(moisture100=moisture*100) but I get an error?
Do heavier cars really use more gasoline? Suppose a car is chosen at random. Let x...
Do heavier cars really use more gasoline? Suppose a car is chosen at random. Let x be the weight of the car (in hundreds of pounds), and let y be the miles per gallon (mpg). x 30 44 33 47 23 40 34 52 y 33 21 22 13 29 17 21 14 Complete parts (a) through (e), given Σx = 303, Σy = 170, Σx2 = 12,123, Σy2 = 3950, Σxy = 6040, and r ≈ −0.853. (a) Draw...
Do heavier cars really use more gasoline? Suppose a car is chosen at random. Let x...
Do heavier cars really use more gasoline? Suppose a car is chosen at random. Let x be the weight of the car (in hundreds of pounds), and let y be the miles per gallon (mpg). x 27 43 29 47 23 40 34 52 y 31 18 27 13 29 17 21 14 Complete parts (a) through (e), given Σx = 295, Σy = 170, Σx2 = 11,617, Σy2 = 3950, Σxy = 5794, and r ≈ −0.951. (a) Draw...
Scatterplots are also called scattergrams or scatter diagrams. Group of answer choices 1.True 2.False Both variables...
Scatterplots are also called scattergrams or scatter diagrams. Group of answer choices 1.True 2.False Both variables should be at interval or ratio scales. 1.True 2.False To run a scatterplot you need to click on the following in SPSS: Analyze Descriptive Statistics Graphs Group of answer choices 1.True 2.False The y-axis should hold your ________ variable. 1.dependent 2.interment 3.independent 4.scaled The x-axis should hold your ______ variable. 1.internment 2.independent 3.scaled 4.dependent To run a scatterplot you need at least 2 variables...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT