Question

In: Statistics and Probability

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 Cognitive behavioral treatment. Perform all necessary steps for the hypothesis test and interpret your results in the context of the study. Assume random selection and normal population distribution for all samples and populations.

Treat Prewt Postwt
1 Cont 80.7 80.2
2 Cont 89.4 80.1
3 Cont 91.8 86.4
4 Cont 74.0 86.3
5 Cont 78.1 76.1
6 Cont 88.3 78.1
7 Cont 87.3 75.1
8 Cont 75.1 86.7
9 Cont 80.6 73.5
10 Cont 78.4 84.6
11 Cont 77.6 77.4
12 Cont 88.7 79.5
13 Cont 81.3 89.6
14 Cont 78.1 81.4
15 Cont 70.5 81.8
16 Cont 77.3 77.3
17 Cont 85.2 84.2
18 Cont 86.0 75.4
19 Cont 84.1 79.5
20 Cont 79.7 73.0
21 Cont 85.5 88.3
22 Cont 84.4 84.7
23 Cont 79.6 81.4
24 Cont 77.5 81.2
25 Cont 72.3 88.2
26 Cont 89.0 78.8
27 CBT 80.5 82.2
28 CBT 84.9 85.6
29 CBT 81.5 81.4
30 CBT 82.6 81.9
31 CBT 79.9 76.4
32 CBT 88.7 103.6
33 CBT 94.9 98.4
34 CBT 76.3 93.4
35 CBT 81.0 73.4
36 CBT 80.5 82.1
37 CBT 85.0 96.7
38 CBT 89.2 95.3
39 CBT 81.3 82.4
40 CBT 76.5 72.5
41 CBT 70.0 90.9
42 CBT 80.4 71.3
43 CBT 83.3 85.4
44 CBT 83.0 81.6
45 CBT 87.7 89.1
46 CBT 84.2 83.9
47 CBT 86.4 82.7
48 CBT 76.5 75.7
49 CBT 80.2 82.6
50 CBT 87.8 100.4
51 CBT 83.3 85.2
52 CBT 79.7 83.6
53 CBT 84.5 84.6
54 CBT 80.8 96.2
55 CBT 87.4 86.7

Solutions

Expert Solution

#### R Statistical Software ####
library(MASS)

data(anorexia)
library(tidyr)

df <- gather(anorexia, key = "pre_post", value = "weight", 2:3)


model = aov(weight~., data = df)
summary(model)

##              Df Sum Sq Mean Sq F value   Pr(>F)   
## Treat         2    644 322.1   7.713 0.000664 ***
## pre_post      1    275   275.0   6.585 0.011335 *
## Residuals   140   5847    41.8                    
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

## you can see that the p-value between pre_post isd 0.011335 < 0.05. Implies there is a
## significant difference in mean weight gain.


Related Solutions

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...
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...
Solve it by R Use the ‘cement’ dataset in ‘MASS’ package to answer the question. (1)...
Solve it by R Use the ‘cement’ dataset in ‘MASS’ package to answer the question. (1) Conduct the multiple linear regression, regress y value on x1, x2, x3 and x4 (without intercept). Report the estimated coefficients. Which predictor variables have strong linear relationship with response variable y at significance level 0.05? (2) What is the adjusted R square of your regression? What is the interquartile range (IQR) of the residuals from your regression? (3) Conduct a best subset regression (with...
1. The dataset prostate (in R package ”faraway”) is from a study on 97 men with...
1. The dataset prostate (in R package ”faraway”) is from a study on 97 men with prostatecancer who were due to receive a radical prostatectomy.Fit a model withlpsa(y) as the response variable andlcavol(x) as the predictor andanswer the following question: •Calculate and plot the 90%confidenceandpredictionbands. Which type ofintervals are wider?
In r studio, what is a method to find significant variables within an entire dataset?
In r studio, what is a method to find significant variables within an entire dataset?
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,...
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...
Consider the beauty dataset from the wooldridge package in R. Suppose you wish to estimate the...
Consider the beauty dataset from the wooldridge package in R. Suppose you wish to estimate the following equation: lwage=β0+β1educ+u Using heteroscedastic-robust standard errors, conduct the hypothesis test H0:β1=0 H1:β1≠0 What is the t-value associated with this test?
R code: ## 2. __Basic dplyr exercises__ ## Install the package `fueleconomy` and load the dataset...
R code: ## 2. __Basic dplyr exercises__ ## Install the package `fueleconomy` and load the dataset `vehicles`. Answer the following questions. install.packages("fueleconomy") library(fueleconomy) library(dplyr) library(tidyr) data(vehicles) e. Finally, for the years 1994, 1999, 2004, 2009, and 2014, find the average city mpg of midsize cars for each manufacturer for each year. Use tidyr to transform the resulting output so each manufacturer has one row, and five columns (a column for each year). I have included sample output for the first...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT