0

I'm trying to make a confidence interval for practice and I keep getting an error referring to:

an 'invalid number of breaks' at hist.default(boot.dist).

I'm pretty sure the problem is somewhere here.

Any advice or help would be very much appreciated at this point.

b=1000
boot.dist = rep(0,b)
for (i in 1:b) {
boot.sample = sample(ACS$Income, replace = TRUE)
boot.dist[i] = mean(boot.sample)
}
hist(boot.dist)
zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 1
    Welcome! It really helps if your questions are both [minimal](http://stackoverflow.com/help/mcve) (which this is) and [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) (this is not). Please read those two links and then edit your question. (For instance, because we don't know what `ACS` is, we cannot reproduce your problem.) – r2evans Apr 07 '16 at 16:19
  • ... this error will come up, though, if you have no finite non-`NA` data in `ACS$Income`. Check to insure `any(! (is.na(ACS$Income) | is.infinite(ACS$Income)) )`. – r2evans Apr 07 '16 at 16:24

1 Answers1

-1

The problem is that ACS$Income is array of NA.
Example, this code will reproduce error exactly like yours:

boot.dist[1:1000]<-NA 
hist(boot.dist )

Error in hist.default(boot.dist) : invalid number of 'breaks'

dmitriy
  • 253
  • 1
  • 17