R homework代写：STA/ISA 333: Nonparametric Statistics
- Complete the following problems below using R.
- Every problem must have a stated final solution with an interpretation(if applicable), not just computer output.
- In any problem involving a hypothesis test,provide all elements of the test: H0, H a, test statistic value, p-value, and a formal conclusion stated in problem context.
- In any problem involving a confidence interval,include a full interpretation of the CI in problem context.
- The final product you turn in must be a hard copy of an R Markdown file, knitted to HTML.
Low birth weight is an outcome that has been of concern to physicians for years. This is due to the fact that infant mortality rates and birth defect rates are very high for low birth weight babies. A woman’s behavior during pregnancy (including diet, smoking habits, and receiving prenatal care) can greatly alter the chances of carrying the baby to term and, consequently, of delivering a baby of normal birth weight.
The variables identified in the table have been shown to be associated with low birth weight in the obstetrical literature. The goal of the current study was to ascertain if these variables were important in the population being served by the medical center where the data were collected.
Data were collected on 189 women, 59 of which had low birth weight babies and 130 of which had normal birth weight babies. R homework代写Four variables which were thought to be of importance were age, weight of the subject at her last menstrual period, race, and the number of physician visits during the first trimester of pregnancy.
LIST OF VARIABLES IN THE DATA SET:
ID Identification Code
LOW Low Birth Weight (0 = Birth Weight ≥ 2500g, 1 = Birth Weight < 2500g)
AGE Age of the Mother in Years
LWT Weight in Pounds at the Last Menstrual Period
RACE Race (1 = White, 2 = Black, 3 = Other)
SMOKE Smoking Status during Pregnancy (1 = Yes, 0 = No)
PTL History of Premature Labor (0 = None, 1 = One, etc.)
HT History of Hypertension (1 = Yes, 0 = No)
UI Presence of Uterine Irritability (1 = Yes, 0 = No)
FTV Number of Physician Visits During the First Trimester (0 = None, 1 = One, 2 = Two, etc.) BWT Birth Weight in Grams
The data reside in the file lowbwt.RData in our repository. Use these data to address the problems below.
Source: Hosmer, D.W., Lemeshow, S. and Sturdivant, R.X. (2013) Applied Logistic Regression: Third Edition.
- Run a Permutation test to determine if there is a difference in the variability between the birth weight for smoking during pregnancy and not. Include all aspects of the hypothesis test.
- It is of interest to compare the distributions of birth weights of babies born to mothers of different races. (Here, RACEis categorized as white, black or other; coded as 1, 2 and 3 respectively).
- Create a nice well-labeled boxplot display for comparing these three birth weight distributions side by side in a single graph. Make an observation/comment comparing the distributions.
- Run a permutation F -test to test the hypothesis that the distributions of birth weights are the same regardless of race. You must provide H 0, H a, calculated value of a test statistic, p- value, and conclusion in problem context. (Note:you have to coerce RACE to be a factor in R, since it is coded as a number in the data set.)
- If the result in 1b is significant, perform a complete multiple comparison analysis to determine which of the races differ with regard to baby weights, and how they differ.
- Does baby weight positively correlate to the weight of the mother (regardless of race)?
- Create a nicely labeled scatterplot of baby weight (y) vs mother weight (x), and comment on what you see.
- Calculate the Spearman correlation between baby weight and mother weight. Comment on the strength and direction of the association, and then run a permutation test to determine if the association is statistically significant. As always, include all elements of the test.
- Run Fishers’ Exact test to see if there is an association between smoking status (SMOKE )and prevalence of low birth weight (LOW ). You must provide H 0, H a, calculated value of a test statistic, p -value, and conclusion in problem context.
- Referring back to question 2, create appropriate pairwise bootstrap confidence intervals for the difference in birth weight of babies born to mothers of different races. Include interpretations for each interval. Does the result confirm your answer to question 2?