So my question is: Use a nonparametric method to find a 95 percent confidence in
ID: 3180586 • Letter: S
Question
So my question is: Use a nonparametric method to find a 95 percent confidence interval for the standard deviation of the number of weeks completed of gestation. Include your R-code in the solution.
this is my code so far but i get this error: (Error in quantile.default(sd2, c(0.025, 0.975)) : missing values and NaN's not allowed if 'na.rm' is FALSE)
any suggestions on fixing the code or going in a diffrent direction would be much appreicated!
sd=sd(Weeks, na.rm = TRUE)
sd2=c(sd(Weeks, na.rm = TRUE))
for(i in 1:10000){
fake=sample(Weeks,length(Weeks),replace = T)
sd2=c(sd2,sd(fake))
}
quantile(sd2,c(.025,.975))
Explanation / Answer
It is not given clearly as to what eactly you are trying to do. There is no dataset provided , hence the complete replication of the error is not possible . However based on the error generated by the R compiler , it is clear that the quantile function is fed with NAs and missing values which the function is not able to handle
(Error in quantile.default(sd2, c(0.025, 0.975)) : missing values and NaN's not allowed if 'na.rm' is FALSE)
so change the quantile funciton to
This ensures that the quantile fucntion is advised to skip the NAs and the missing values during calculation
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.