Question

In: Statistics and Probability

R has many build-in dataset. The data mtcars is one of them. The following R code...

  1. R has many build-in dataset. The data mtcars is one of them. The following R code read-in data and save the data to input.

                  input <- mtcars[,c("am","cyl","hp","wt")]

             Write a few line of R code to conduct a regression analysis with am as the response variable, and

             cyl, hp, wt as explanation variables.

Solutions

Expert Solution

The whole data contained mtcars is,we take subset of whole data using command,

input <- mtcars[,c("am","cyl","hp","wt")]

we want to take am as response variable and others are explanation variables then we use commands

a=lm(am~cyl+hp+wt,data=input) #linear model command am as response and other are explanation variables

summary(a) #this gives anova table and other neccessary outputs

code:-

>mtcars

> input <- mtcars[,c("am","cyl","hp","wt")]
> input

> a=lm(am~cyl+hp+wt,data=input)
> summary(a)

result:- If p-value < alpha then we reject Ho.


Related Solutions

R has a number of datasets built in. One such dataset is called mtcars. This data...
R has a number of datasets built in. One such dataset is called mtcars. This data set contains fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models) as reported in a 1974 issue of Motor Trend Magazine. We do not have to read in these built-in datasets. We can just attach the variables by using the code attach(mtcars) We can just type in mtcars and see the entire dataset. We can see the variable...
Examine classification using logistic regression. In R console, type mtcars. The dataset mtcars is a generic...
Examine classification using logistic regression. In R console, type mtcars. The dataset mtcars is a generic dataset in R. This dataset comprises of fuel consumption and 10 aspects of automobile design and performance for 32 automobiles. Using only the variables am (0 = automatic, 1 = manual) and mpg, your task is to fit a logistic regression model. Complete the following steps using R. Create a scatter plot of am vs. mpg. Describe the relationship and explain why a simple...
using the mtcars data set data(mtcars) USE data in mtcars library in R 5.Use k means...
using the mtcars data set data(mtcars) USE data in mtcars library in R 5.Use k means cluster analysis. 6. Get cluster means. 7. Visualize the clustering result.
For the mtcars dataset (in R), comment on how Rear axle ratio is associated with Displacement...
For the mtcars dataset (in R), comment on how Rear axle ratio is associated with Displacement (cu.in.) and Miles/(US) gallon using the following steps: Draw appropriate scatterplot(s) [Show your code in “R Code” section. Leave “Answer” section blank. Justify your choice of charts in a few sentences in “Comments” section. No screenshots of the charts are required.] Determine correlation coefficient(s) [Show your code in “R Code” section. Show the answer in “Answer” section. Leave “Comments” section blank.] Calculate and plot...
Using R Studio: 1)Use the `mtcars` data (`data(mtcars)`) to answer these questions: a) Which rows of...
Using R Studio: 1)Use the `mtcars` data (`data(mtcars)`) to answer these questions: a) Which rows of the data frame contain cars that weigh more than 4000 pounds (the variable is `wt`, units are 1000 pounds). b) Which cars are these? (*Hint:* since rows are named by car name, use `row.names()`). c) What is the mean displacement (in inches^3^ ) for cars with at least 200 horsepower (`hp`). d) Which car has the highest fuel economy (`mpg`)? e) What was the...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing...
ANSWER USING R CODE Using the dataset 'LakeHuron' which is a built in R dataset describing the level in feet of Lake Huron from 1872- 1972. To assign the values into an ordinary vector,x, we can do the following 'x <- as.vector(LakeHuron)'. From there, we can access the data easily. Assume the values in X are a random sample from a normal population with distribution X. Also assume the X has an unknown mean and unknown standard deviation. With this...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model with mpg: Miles/(US) gallon as the response and the other variables as predictors. (a) Which variables are statistically significant at the 5% level? For each and every test provide the null and alternative hypotheses, critical region (or rejection region), test statistics and your conclusions. (30) (b) What interpretation should be given to the coefficient for vs: Engine? (3) (c) Compute 90 and 95% confidence...
Using the mtcars dataset, answer the following questions: Fill in the following table: Variable Correlation with...
Using the mtcars dataset, answer the following questions: Fill in the following table: Variable Correlation with mpg cyl -0.85216 disp -0.84755 hp -0.77617 drat 0.681172 wt -0.86766 qsec 0.418684 vs 0.664039 am 0.599832 gear 0.480285 carb -0.55093 mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4 Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108...
Instructions tell you how to get the data in R R has built in dataset called...
Instructions tell you how to get the data in R R has built in dataset called Iris. This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. We are interested in estimating the length of Petal (Y) using the length of Sepal (X). First, load the...
Use the following dataset and assume all assumptions are met Provide all R code needed to...
Use the following dataset and assume all assumptions are met Provide all R code needed to conduct the tests Bat house color and species Lasiurus in brown: 45, 49, 53, 54, 46, 51, 50, 48, 52, 50 Myotis in brown: 40, 38, 35, 39, 39, 44, 42, 48, 41, 40 Lasiurus in tan: 53, 49, 51, 52, 59, 54, 53, 54, 58, 51 Myotis in tan: 62, 64, 59, 61, 65, 61, 58, 63, 56, 61 Provide the three hypotheses...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT