Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following question should be coded in R studio. ### Problem 6 The dataset $\

ID: 3316938 • Letter: T

Question

The following question should be coded in R studio.

### Problem 6 The dataset $f ICUAdmissions$ (http://www.lock5stat.com/datasets/ICUAdmissions.csv) contains information on oa sample of 200 patients being admitted to the Intense Care Unit (ICU) at a hospital. One of the variables is HeartRate and another is Status which indicates whether the patient lived (Status-0) or died (Status-1) a) Download the dataset and find out what it contains. Create two groups of patients and for each of them compute the mean, standard deviation, and size. #Include R code below this line b) Use the computer output to give the details of a test to determine whether mean heart rate is different between patients who lived and died at a level of significance of $5 How the result will change if the level of significance is changed to $10 %$? #Include R code below this line

Explanation / Answer

The complete R snippet is as follows

data.df<- read.table("http://www.lock5stat.com/datasets/ICUAdmissions.csv",sep=",",header=T)


## summary
summary(data.df)
str(data.df)


##subset data based on conditions

data0 <- subset(data.df,Status==0,select=c("Status","HeartRate"))

data1 <- subset(data.df,Status==1,select=c("Status","HeartRate"))


## mean sd and size
mean(data0$HeartRate);sd(data0$HeartRate);nrow(data0)
mean(data1$HeartRate);sd(data1$HeartRate);nrow(data1)


## perform the t test

t.test(data0$HeartRate,data1$HeartRate,alternative = "two.sided",conf.level = 0.95)

The results are

> ## mean sd and size
> mean(data0$HeartRate);sd(data0$HeartRate);nrow(data0)
[1] 98.5
[1] 26.97868
[1] 160
> mean(data1$HeartRate);sd(data1$HeartRate);nrow(data1)
[1] 100.625
[1] 26.49304
[1] 40
>
>
> ## perform the t test
>
> t.test(data0$HeartRate,data1$HeartRate,alternative = "two.sided",conf.level = 0.95)

   Welch Two Sample t-test

data: data0$HeartRate and data1$HeartRate
t = -0.45207, df = 60.84, p-value = 0.6528
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-11.525028 7.275028
sample estimates:
mean of x mean of y
98.500 100.625