Hey, I'm doing a University assignment that involves using R studio and I feel stuck. Below firstly is the question I'm currently doing and the R output, any help would be very much appreciated.
Cheers, Daniel
Based on past experience with clinical use of a hypertension drug, a drug company expects that, if the drug is administered under medical supervision to 4 randomly selected hypertension patients who were previously untreated, the number whose hypertension is brought under control will follow this distribution:
No. brought under control 0, 1, 2, 3, 4
Proportion .004, .047, .211, .422, .316
The company supplied the drug to 128 doctors who agreed to use it on their next 4 hypertensive patients. 21 of the doctors were successful with all 4 patients, 63 were successful with 3, 34 succeeded with just 2 patients, and 9 succeeded with only 1 of their next 4 patients. (Here “succeeded” means “brought the patient’s hypertension under control”.) Are these results consistent with the distribution of successes expected by the company? Evaluate with a suitable hypothesis test at 5% significance level, taking care to evaluate and address any concerns over the assumptions.
Obs=c( 1, 9, 34, 63, 21)
> props=c(.004, .047, .211, .422, .316)
> Xsq=chisq.test(Obs, p=props)
Warning message:
In chisq.test(Obs, p = props) : Chi-squared approximation may be incorrect
> Xsq$observed
[1] 1 9 34 63 21
> Xsq$expected
[1] 0.512 6.016 27.008 54.016 40.448
> Xsq$residuals
[1] 0.6820007 1.2165919 1.3454117 1.2223865 -3.0579221
> Xsq
Chi-squared test for given probabilities
data: Obs
X-squared = 14.6, df = 4, p-value = 0.005606