On 07/08/2011 07:22 PM, gwanme...@aol.com wrote:
Dear Sir,
I am doing some work on a population of patients. About half of them are
admitted into hospital with albumin levels less than 33. The other half have
albumin levels greater than 33, so I stratify them into 2 groups, x and y
respectively.
I suspect that the average length of stay in hospital for the group of
patients (x) with albumin levels less than 33 is greater than those with
albumin levels greater than 33 (y).
What command function do I use (assuming that I will be using the chi
square test) to show that the length of stay in hospital of those in group x is
statistically significantly different from those in group y?
Hi Ivo,
Just to make things even more complicated for you, Mark's suggestion
that the length_of_stay measure is unlikely to be normally distributed
might lead you to look into a non-parametric test like the Wilcoxon (aka
Mann-Whitney in your case) test. You will have to split your
length_of_stay measure into two like this (assume your data frame is
named "losdf"):
albumin_hilo <- albumin > 33
wilcox.test(losdf$length-of-stay[albumin_hilo],
losdf$length_of_stay[!albumin_hilo])
or if you use wilcox_test in the "coin package:
albumin_hilo <- albumin > 33
wilcox_test(length_of_stay~albumin_hilo,losdf)
Do remember that the chi-square test is used for categorical variables,
for instance if you dichotomized your length_of_stay into less than 10
days or 10 days and over.
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.