0
votes

Using R, I am creating 3 distributions and they seem to be made, however, when I try to use the confint to determine the upper and lower limits, I get a "Nans produced warning" Below is the code. My friend tried the same and his does not have the issue. I should mention I am doing this Jupyter.

set.seed(1)
n.sim=100
smpl.sizes=c(1,2,4,8,16,32,64,128,256,512,1024)

for (smpl.n in smpl.sizes){
    norm.counter<-0
    exp.counter<-0
    uni.counter<-0

    norm.f<-numeric()
    exp.f<-numeric()
    uni.f<-numeric()

       for (i in 1:n.sim){
          norm<-rnorm(smpl.n)
          exp<-rexp(smpl.n)    
          uni<-runif(smpl.n)  

           norm.cint.upper <- confint(lm(norm~1))[2]
           norm.cint.upper <- confint(lm(norm~1))[1]
           exp.cint.upper <- confint(lm(exp~1))[2]
           exp.cint.upper <- confint(lm(exp~1))[1]
           uni.cint.upper <- confint(lm(uni~1))[2]
           uni.cint.upper <- confint(lm(uni~1))[2]
}

}

As soon as I run the confint, I get the warnings.

1

1 Answers

0
votes

So it looks like the culprit is that some of my low sample sizes were just not sufficient to be able to remove the NAns

Error smpl.sizes=c(1,2,4,8,16,32,64,128,256,512,1024)

Solution

smpl.sizes=c(16,32,64,128,256,512,1024)