Question

In: Statistics and Probability

USING R ---locate the pre-loaded MASS package, then load the data frame cats within that packag....

USING R ---locate the pre-loaded MASS package, then load the data frame cats within that packag. This provides data on sex, body weight (in kgs), and heart weight (in grams) for 144 household cats. Load the MASS package with a call to library("MASS"), and access the object directly by entering cats at the console prompt.

1. Fit a least-squares multiple linear regression model using heart weight as the response variable and the other two variables as predictors, and view a model summary. Write down the equation for a least-squares multiple linear regression fitted model and interpret the estimated regression coefficients for body weight and sex (of the cats in the above package). Are both statistically significant? What does this say about the relationship between the response and predictors?

Solutions

Expert Solution

library(MASS)
data(cats)
head(cats,n=2) # it show first two row of cats data
Sex Bwt Hwt
1 F 2 7.0
2 F 2 7.4
#1. Fit a least-squares multiple linear regression model using heart weight as the response variable and the other two variables as predictors, and view a model summary.
model=lm(Hwt~Bwt+Sex,data=cats)
model

Call:
lm(formula = Hwt ~ Bwt + Sex, data = cats)

Coefficients:
(Intercept) Bwt SexM
-0.4150 4.0758 -0.0821

> summary(model)

Call:
lm(formula = Hwt ~ Bwt + Sex, data = cats)

Residuals:
Min 1Q Median 3Q Max
-3.5833 -0.9700 -0.0948 1.0432 5.1016

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4149 0.7273 -0.571 0.569
Bwt 4.0758 0.2948 13.826 <2e-16 ***
SexM -0.0821 0.3040 -0.270 0.788
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.457 on 141 degrees of freedom
Multiple R-squared: 0.6468, Adjusted R-squared: 0.6418
F-statistic: 129.1 on 2 and 141 DF, p-value: < 2.2e-16

so from above R-output.

the equation for a least-squares multiple linear regression fitted model

Hwt = -0.4150+4.0758 *Bwt--0.0821*SexM

interpret the estimated regression coefficients for body weight and sex

For body weight = 4.0758

It can be interpreted as if we change body weight by 1 kg then their is average increase in heart weight by 4.0758 kg by keeping Sex constant.

For Sex Male = -0.0821

It can be interpreted as if your sex is male then their is average decrease in heart weight by  -0.0821 kg by keeping Body weight constant.

Are both statistically significant?

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.4149 0.7273 -0.571 0.569
Bwt 4.0758 0.2948 13.826 <2e-16 ***
SexM -0.0821 0.3040 -0.270 0.788

From above output P-value for Body weight is <2e-16 < 0.05 level of significance so we reject the null hypothesis and conclude that Body weight is statistically significant variable.

From above output P-value for Sex 0.788 > 0.05 level of significance so we accept the null hypothesis and conclude that Sex is not statistically significant variable.

What does this say about the relationship between the response and predictors?

F-statistic: 129.1 on 2 and 141 DF, p-value: < 2.2e-16

Here p-value is (< 2.2e-16) < 0.05 level of significance so we reject the null hypothesis and conclude that relationship between he response and predictors statistically significant.



Related Solutions

load the MASS library in R. A. Package ‘MASS’ which provides a description of the datasets...
load the MASS library in R. A. Package ‘MASS’ which provides a description of the datasets available in the MASS package. Then, answer each of the following questions using the appropriate test statistic and following formal steps of hypothesis testing. A:Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did the drug treatment have a significant effect of the presence of the bacteria compared with the placebo?” B: F-test: Use the “cats” data set...
question about R: The vectors state.name, state.area, and state.region are pre-loaded in R and contain US...
question about R: The vectors state.name, state.area, and state.region are pre-loaded in R and contain US state names, area (in square miles), and region respectively. (a) Identify the data type for state.name, state.area, and state.region. (b) What is the longest state name (including spaces)? How long is it? (c) Compute the average area of the states which contain the word “New” at the start of the state name. Use the function substr(). (d) Use the function table() to determine how...
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In...
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In the study, three treatments (Treat) were applied to groups of young female anorexia patients, and their weights before (Prewt) and after (Postwt) treatment were recorded. The three treatments adminstered were no treatment (Cont), Cognitive Behavioural treatment (CBT), and family treatment (FT). Determine at the 5% significance level if there is a difference in mean weight gain between those receiving no treatment and those receiving...
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In...
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In the study, three treat- ments (Treat) were applied to groups of young female anorexia patients, and their weights before (Prewt) and after (Postwt) treatment were recorded. The three treatments adminstered were no treatment (Cont), Cognitive Behavioural treatment (CBT), and family treatment (FT). Determine at the 5% significance level if there is a difference in mean weight gain between those receiving no treatment and those...
Use R statictical software. Load the ISLR package to get the Auto data set. Fit below...
Use R statictical software. Load the ISLR package to get the Auto data set. Fit below non-linear models to the Auto data set. We will treat horsepower as the predictor and mpg as the response. • Fit the cubic spline with 3 knots (25th percentile, 50th percentile, and 75th percentile of horsepower) • Fit the natural spline with 3 knots (25th percentile, 50th percentile, and 75th percentile of horsepower) • Fit the smoothing spline by choosing optimal lambda with cross-validation....
2. The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study....
2. The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In the study, three treatments (Treat) were applied to groups of young female anorexia patients, and their weights before (Prewt) and after (Postwt) treatment were recorded. The three treatments adminstered were no treatment (Cont), Cognitive Behavioural treatment (CBT), and family treatment (FT). Determine at the 5% significance level if Cognitive Behavioral treatment is effective in helping patients gain weight. Perform all necessary steps for...
Using R studio 1. Read the iris data set into a data frame. 2. Print the...
Using R studio 1. Read the iris data set into a data frame. 2. Print the first few lines of the iris dataset. 3. Output all the entries with Sepal Length > 5. 4. Plot a box plot of Petal Length with a color of your choice. 5. Plot a histogram of Sepal Width. 6. Plot a scatter plot showing the relationship between Petal Length and Petal Width. 7. Find the mean of Sepal Length by species. Hint: You could...
Using the package “wooldridge’, and the data ‘hprice1’ (in R-Software) to estimate the model price =...
Using the package “wooldridge’, and the data ‘hprice1’ (in R-Software) to estimate the model price = β0 + β1sqrft + β2bdrms + u , where is the house price measured in thousands of dollars. 1. Write out the results in equation form. 2.  What is the estimated increase in price for a house with one more bedroom, holding square footage constant? 3. What is the estimated increase in price for a house with an additional bedroom that is 140 square feet...
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,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT