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

Important: Make sure the MASS package is selected under the packages tab in R-Studio.
Useful Tip: The command subset(anorexia, Treat == "Cont")$Prewt could be used to access just the Prewt values
for subjects in the Cont treatment group.

This is the code/data I have:

> library(MASS)
> attach(anorexia)
> data=anorexia
> newdata=data[Treat=="FT",]
> newdata
Treat Prewt Postwt
56 FT 83.8 95.2
57 FT 83.3 94.3
58 FT 86.0 91.5
59 FT 82.5 91.9
60 FT 86.7 100.3
61 FT 79.6 76.7
62 FT 76.9 76.8
63 FT 94.2 101.6
64 FT 73.4 94.9
65 FT 80.5 75.2
66 FT 81.6 77.8
67 FT 82.1 95.5
68 FT 77.6 90.7
69 FT 83.5 92.5
70 FT 89.9 93.8
71 FT 86.0 91.7
72 FT 87.3 98.0
> test=t.test(data$Postwt,data$Prewt,alt="greater")
> test

Solutions

Expert Solution

The R output is:

The R code is:

library(MASS)
attach(anorexia)
data=anorexia
newdata=data[Treat=="FT",]
newdata
t.test(data$Postwt,data$Prewt,paired = TRUE, alternative ="two.sided")

The hypothesis being tested is:

H0: µd = 0

Ha: µd ≠ 0

p-value = 0.0044

Since the p-value (0.0044) is less than the significance level (0.05), we can reject the null hypothesis.

Therefore, we can conclude that

there is a difference in mean weight gain between those receiving no treatment and those receiving Cognitive-behavioral treatment.

Please give me a thumbs-up if this helps you out. Thank you!


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 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...
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