Question

In: Math

Bonus Using permutation test SAS code , do the following: Trauma data Metabolic Expenditure Nontrauma patients:...

Bonus

Using permutation test SAS code , do the following:

Trauma data

Metabolic Expenditure

Nontrauma patients: 20.1 22.9 18.8 20.9 20.9 22.7 21.4 20

trauma patients: 38.5 25.8 22 23 37.6 30 24.5

Part A

Build the permutation distribution (using 5,000 permutations) for the rank sum statistic for the Trauma

data used above. Use SAS to fit/overlay a normal curve to the resulting histogram. Compare the mean and

standard deviation of this normal curve that was fit to the permutation/randomization distribution to the

mu and sigma you found earlier in the homework.

Part B

Compare the one-sided p-value found in this permutation distribution with the one found in prior questions.

Solutions

Expert Solution

We shall use R to answer this

Nontrauma<- c(20.1,22.9,18.8,20.9,20.9,22.7,21.4,20)
Trauma<-c(38.5,25.8,22,23,37.6,30,24.5)

# rank functions
rank(Nontrauma)
rank(Trauma)

# z stats is x-mean/sd

mtr<-mean(Trauma)
SDtr<-sd(Trauma)

zTrauma<- (Trauma-mtr)/SDtr

# for non trauma patients

mntr<-mean(Nontrauma)
SDntr<-sd(Nontrauma)

zNonTrauma<- (Nontrauma-mntr)/SDntr

# wilcox test for the patients
wilcox.test(Nontrauma,Trauma)


# medians for the patients

medTrauma<- median(Trauma)
medNTrauma <- median(Nontrauma)


# write a function in R for Z test
z.test = function(a, mu, var){
zeta = (mean(a) - mu) / (sqrt(var / length(a)))
return(zeta)
}

z.test(Trauma,medTrauma,SDtr^2)
z.test(Nontrauma,medNTrauma,SDntr^2)

The results of the above snippet are

> rank(Nontrauma)
[1] 3.0 8.0 1.0 4.5 4.5 7.0 6.0 2.0
> rank(Trauma)
[1] 7 4 1 2 6 5 3

> mtr
[1] 28.77143
> SDtr
[1] 6.835377
> zTrauma
[1] 1.4232677 -0.4347132 -0.9906445 -0.8443468 1.2915997 0.1797372 -0.6249002

> mntr
[1] 20.9625
> SDntr
[1] 1.379376
> zNonTrauma
[1] -0.62528267 1.40462048 -1.56773770 -0.04531034 -0.04531034 1.25962740
[7] 0.31717237 -0.69777921

> wilcox.test(Nontrauma,Trauma)

   Wilcoxon rank sum test with continuity correction

data: Nontrauma and Trauma
W = 2, p-value = 0.00314
alternative hypothesis: true location shift is not equal to 0

> z.test(Trauma,medTrauma,SDtr^2)
[1] 1.150143
> z.test(Nontrauma,medNTrauma,SDntr^2)
[1] 0.128157


Related Solutions

Trauma and Metabolic Expenditure: The data set “MetabolicExpenditures”contains metabolic expenditures for eight randomly selected patients admitted...
Trauma and Metabolic Expenditure: The data set “MetabolicExpenditures”contains metabolic expenditures for eight randomly selected patients admitted to a hospital for reasons other than trauma (NonTrauma) and for seven randomly selected patients admitted for multiple fractures (Trauma). (Data from C.L. Long, et al. “Contribution of Skeletal Muscle Protein in Elevated Rates of Whole Body Protein Catabolism in Trauma Patients,” American Journal of Clinical Nutrition, 34: (1981): 1087—1093.) Before collecting the data, the researchers hypothesize that trauma patients have higher metabolic expenditures...
Write code in SAS to do each of the following I have posted the data below...
Write code in SAS to do each of the following I have posted the data below from a pace delimited data set consisting of 66 randomly selected cars Upload the data set to SAS and store it as a SAS data set called cars. Make sure the full values are stored for all character variables. Create a comparative bar chart (with appropriate title and labels) displaying the brands of each car by fuel type (so that fuel type is on...
Using this SAS code for the data. The outcome variable is SBP and should be coded...
Using this SAS code for the data. The outcome variable is SBP and should be coded to appear on the y-axis. Note: you have to write the appropriate program Answer the following questions: Report the correlation coefficient and the p-value. (2pts) Report the parameter estimate for the intercept and heart rate (4pts) Using the regression equation, what is the expected blood pressure for someone with a heart rate of 153? (4pts) data sas_test; input hr sbp; datalines; 35 80 50...
In statistics, how do you test independence using SAS programming?
In statistics, how do you test independence using SAS programming?
Using SAS is preferred but not required. Please provide SAS code and the relevant output if...
Using SAS is preferred but not required. Please provide SAS code and the relevant output if SAS is used. •             Link to referenced FEV.CSV: https://drive.google.com/open?id=1t1CRIbnTE7xL_OE9Bmajb564RXcg8nDo For all hypothesis testing problems: •             state the null and alternative hypotheses, •             calculate the value of the test statistic, •             determine if the results are statistically significant (using rejection region or p-value approaches), •             then state your conclusion in terms of the problem. 1.            FEV (forced expiratory volume) is an index of pulmonary function...
1. Using the following code identify the fault. 2. Using the following code indentify a test...
1. Using the following code identify the fault. 2. Using the following code indentify a test case that results in an error, but not a failure. public static int lastZero (int[] x) { //Effects: if x == null throw NullPointerException //else return the index of the last 0 in x. //Return -1 if 0 does not occur in x for (int i = 0; i < x.length; i++) { if (x[i] == 0) { return i; } } return -1;...
A patient's energy expenditure is measured using indirect calorimetry with a metabolic cart in a rested...
A patient's energy expenditure is measured using indirect calorimetry with a metabolic cart in a rested state and they have not eaten for 2 days other than clear liquids (clear liquids have CHO and no other source of kcalories). The RQ is 0.72 and the REE is 1400 kcal extrapolated for 24 hours. What does the RQ mean and how many kcalories does this person need, i.e. what is their TEE?
Using the following lines of data, create a temporary SAS data set called ThreeDates. Each line...
Using the following lines of data, create a temporary SAS data set called ThreeDates. Each line of data contains three dates, the first two in the form mm/dd/yyyy descenders and the last in the form ddmmmyyyy. Name the three date variables Date1, Date2, and Date3. Format all three using the MMDDYY10. format. Include in your data set the number of years from Date1 to Date2 (Year12) and the number of years from Date2 to Date3 (Year23). Round these values to...
Here is the start of the SAS code to address this question: DATA READING; INPUT GROUP...
Here is the start of the SAS code to address this question: DATA READING; INPUT GROUP $ WORDS @@; DATALINES; X 700 X 850 X 820 X 640 X 920 Y 480 Y 460 Y 500 Y 570 Y 580 Z 500 Z 550 Z 480 Z 600 Z 610 ; Is there a significant difference between the mean reading score among the groups? Yes No Assuming you answer "yes" in the previous question, between what groups was there a...
I need the code in SAS and R and outputs please 2. The data below come...
I need the code in SAS and R and outputs please 2. The data below come from a study investigating a method of measuring body composition, and give the body fat percentage (% fat), age and sex for 18 adults aged between 23 and 61 years. Source: Mazess, R.B., Peppler, W.W., and Gibbons, M. (1984) Total body composition by dual-photon (153GD) absorptiometry. American Journal of Clinical Nutrition, 40, 834-839. age % fat sex 23 9.5 male 23 27.9 female 27...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT