Answer the following question by showing the codes in R
using the cor(t(mtcars)) the following is the correlation table among the variables and found that
since there are N=32 observations( number of cars)
so the significant correlation coefficient=0.349 at two tailed alpha=0.05 with n-2=32-2=30. therefore all the variables significantly correlated to mpg, as the all the absolute correlation coefficient is more than 0.349 ( please look critical r on standard book or internet). But the wt is most significant correlated(negative).
the scatter plot mpg(x1) and wt( x6) is given as
mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | |
mpg | 1.0000 | -0.8522 | -0.8476 | -0.7762 | 0.6812 | -0.8677 | 0.4187 | 0.6640 | 0.5998 | 0.4803 | -0.5509 |
cyl | -0.8522 | 1.0000 | 0.9020 | 0.8324 | -0.6999 | 0.7825 | -0.5912 | -0.8108 | -0.5226 | -0.4927 | 0.5270 |
disp | -0.8476 | 0.9020 | 1.0000 | 0.7909 | -0.7102 | 0.8880 | -0.4337 | -0.7104 | -0.5912 | -0.5556 | 0.3950 |
hp | -0.7762 | 0.8324 | 0.7909 | 1.0000 | -0.4488 | 0.6587 | -0.7082 | -0.7231 | -0.2432 | -0.1257 | 0.7498 |
drat | 0.6812 | -0.6999 | -0.7102 | -0.4488 | 1.0000 | -0.7124 | 0.0912 | 0.4403 | 0.7127 | 0.6996 | -0.0908 |
wt | -0.8677 | 0.7825 | 0.8880 | 0.6587 | -0.7124 | 1.0000 | -0.1747 | -0.5549 | -0.6925 | -0.5833 | 0.4276 |
qsec | 0.4187 | -0.5912 | -0.4337 | -0.7082 | 0.0912 | -0.1747 | 1.0000 | 0.7445 | -0.2299 | -0.2127 | -0.6562 |
vs | 0.6640 | -0.8108 | -0.7104 | -0.7231 | 0.4403 | -0.5549 | 0.7445 | 1.0000 | 0.1683 | 0.2060 | -0.5696 |
am | 0.5998 | -0.5226 | -0.5912 | -0.2432 | 0.7127 | -0.6925 | -0.2299 | 0.1683 | 1.0000 | 0.7941 | 0.0575 |
gear | 0.4803 | -0.4927 | -0.5556 | -0.1257 | 0.6996 | -0.5833 | -0.2127 | 0.2060 | 0.7941 | 1.0000 | 0.2741 |
carb | -0.5509 | 0.5270 | 0.3950 | 0.7498 | -0.0908 | 0.4276 | -0.6562 | -0.5696 | 0.0575 | 0.2741 | 1.0000 |
(b) the regression analysis shows the independent variable wt is significantly explaining the dependent variable mpg as the p-value is less than the typical value of alpha=0.05
following are the R-ouput
> lm(mpg~wt)
Call:
lm(formula = mpg ~ wt)
Coefficients:
(Intercept) wt
37.285 -5.344
> summary(lm(mpg~wt))
Call:
lm(formula = mpg ~ wt)
Residuals:
Min 1Q Median 3Q Max
-4.5432 -2.3647 -0.1252 1.4096 6.8727
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 37.2851 1.8776 19.858 < 2e-16 ***
wt -5.3445 0.5591 -9.559 1.29e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.046 on 30 degrees of freedom
Multiple R-squared: 0.7528, Adjusted R-squared: 0.7446
F-statistic: 91.38 on 1 and 30 DF, p-value: 1.294e-10
Answer the following question by showing the codes in R 2. Consider the dataset mtcars and...
The Motor Trend Car Road Tests dataset mtcars, in faraway R package, was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models). The data frame has 32 observation on 11 (numeric) variables: mpg: Miles/(US) gallon; cyl: Number of cylinders; disp: Displacement (cu.in.); hp: Gross horsepower; drat: Rear axle ratio; wt: Weight (1000 lbs); qsec: 1/4 mile time; vs: Engine (0 = V-shaped, 1 =...
PLEASE ANSWER ALL parts . IF YOU CANT ANSWER ALL, KINDLY ANSWER PART (E) AND PART(F) FOR PART (E) THE REGRESSION MODEL IS ALSO GIVE AT THE END. REGRESSION MODEL: We will be returning to the mtcars dataset, last seen in assignment 4. The dataset mtcars is built into R. It was extracted from the 1974 Motor Trend US magazine, and comcaprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models). You can find...
Consider the R builtin dataset cars: data(mtcars) – Divide the data into training and test data such that 80% of the data is randomly assigned to the training data and the remaining 20% is assigned to the test data. Use set.seed(100) in your code before performing the split to main reproducibility of results. (Hint: use the R function sample) – Fit dist vs speed (as the independent variable) using a linear model on the training data and print a summary...
1. For each of the following regression models, write down the X matrix and 3 vector. Assume in both cases that there are four observations (a) Y BoB1X1 + B2X1X2 (b) log Y Bo B1XiB2X2+ 2. For each of the following regression models, write down the X matrix and vector. Assume in both cases that there are five observations. (a) YB1XB2X2+BXE (b) VYBoB, X,a +2 log10 X2+E regression model never reduces R2, why 3. If adding predictor variables to a...
For this exercise we will run a regression using Swiss demographic data from around 1888. The sample is a cross-section of French speaking counties in Switzerland This data come with the R package datasets. The first step is to load the package into your current environment by typing the command libraryldatasets) in to the R console. This loads a number of datasets including one called swiss. Type help/swiss) in the console for additional details. The basic variable definitions are as...
The R code will help to answer the question. 8. DeGroot&Shervish (2002) consider an experiment to study the combined effects of taking a stimulant and a tranquilizer. In this experiment three types of stimulant and four types of tranquilizer are administered to a group of rabbits. Each rabbit received one of the stimulants, then 20 minutes later, one of the tranquilizers. One hour later their response time (in microseconds) to a stimulus was measured. The results were: Tranquilizer Stimulant 1...
2-6% each part Suppose we have opened a catfish hot dog stand at the mall which will be open 4 hours per day. We are test marketing our sales at various prices to attempt to determine the best price we should use for our catfish hot dogs. So, let: Price of the Number of y hot dogs $1.50 $3.00 $4.00 hot dogs sold 182 118 39 Notice that we have put these variables in the same order that we did...
7 Consider the following regression output involving the variables y and, rı, r2. (note log is the natural logarithm as usual) 4.12 0.88 r Model A: Model B: log(y)0.34 0.14 + 0.001 2 Model C: logly)2011.4 log()0.02 r2 0.06 Model D: Model E: y = 5.4 + 0.82i --3.4 55.1 log(0.020 2 + 1.2r2 0.2 (1x2) Ceteris Paribus: (a) In Model A: If x1 increases 6 to 8 by 2 units, then the predicted change in y is Δy =...
R studio #Exercise : Calculate the following probabilities : #1. Probability that a normal random variable with mean 22 and variance 25 #(i)lies between 16.2 and 27.5 #(ii) is greater than 29 #(iii) is less than 17 #(iv)is less than 15 or greater than 25 #2.Probability that in 60 tosses of a fair coin the head comes up #(i) 20,25 or 30 times #(ii) less than 20 times #(iii) between 20 and 30 times #3.A random variable X has Poisson...