Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use R - software please We will use a data set that is included with the R package called mtcars, which has measures on 3

Use R-software please We will use a data set that is included with the R package called mtcars, which has measures on 32 cars from Motor Trend magazine from the 1973-74 model years.
If you type ?mtcars in the R console window, you will see an explanation of the data set displayed in the Help window.
You can view the first view rows of the data set by typing head(mtcars) in the console window.
We will estimate a regression model where we try to explain the miles per gallon measure (abbreviated as mpg) using the engine size of the car in cubic inches, known as displacement and abbreviated as disp. In other words, mpg will be the response variable and disp will be the explanatory variable.
Steps:
1) Issue the command attach(mtcars) so that the variables in the data set are in the search path when you issue a command; this allows you to refer to the variables directly. Otherwise, you would have to write mtcars$mpg and mtcars$disp to refer to the variables.
3) Use the plot() function to create a scatter plot with mpg (our response variable) on the vertical axis and disp (our explanatory variable) on the horizontal axis. Remember to include your name(s) in the main title of the plot using the main= parameter.
5) Use the lm() function (which stands for linear model) to estimate a regression equation with mpg as the response variable and disp as the explanatory variable. Remember to use the tilde special character (~) between the response variable and explanatory variable. The lm function returns the results as an object that you can assign to a variable (such as result) as illustrated in the chapter 14 R software notes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

Students also viewed these Databases questions

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago