[R] Fw: passing different sample sizes

Bert Gunter
2017-09-25T22:00:08Z

1. 2o is gibberish; 20 is the number of fingers and toes most of us have.

2. This is a plain text list. Your code became gibberish with your HTML
post.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Mon, Sep 25, 2017 at 2:16 PM, Farnoosh Sheikhi via R-help <
r-help at r-project.org> wrote:

>
>
>
>
> 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 at 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.