Hi, 
I have the below function which returns confidence intervals. I wanted to pass 
different sample sizes through the function, but for some reason it's not 
working. n   <- seq(from=40, to=300, by=2o)

I was also wondering how I can return a plot for different sample sizes. 
plot(m~d, main="n(i)") 
Any help or suggestion is appreciated.


############################f<-function(n){  m = runif(n,50,200)  d =  
rnorm(n,0,1)   ci.u<-mean(d)+1.96*sd(d)  ci.l<-mean(d)-1.96*sd(d)  
ci.w<-ci.u-ci.l    se=sd(d)/sqrt(n)  w.ci.uu<-ci.u+(qt(.975, df=n-1))*1.71*se  
w.ci.ul<-ci.u-(qt(.975, df=n-1))*1.71*se  w.ci.upper<-w.ci.uu- w.ci.ul    
w.ci.lu<-ci.l+(qt(.975, df=n-1))*1.71*se  w.ci.ll<-ci.l-(qt(.975, 
df=n-1))*1.71*se  w.ci.lower<-w.ci.lu- w.ci.ll    res<-as.data.frame(cbind(n, 
ci.u, ci.l, ci.w, w.ci.upper, w.ci.lower))  return(res)} Best,Nooshi





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to