# [R] Fw: passing different sample sizes

Farnoosh Sheikhi farnoosh_81 at yahoo.com
Mon Sep 25 23:16:48 CEST 2017

```

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]]

```