RE: [R] sample function

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Fri 11 Mar 2005 - 14:05:15 EST


It's not the simulated data, but how hist() handled it. If you use truehist() in the MASS package, you don't see the problem. Nor would you see it like this:

> table(temp)/length(temp)

temp

     0 1 2 3 4 5 6 7 8 9 10 11
0.0745 0.0745 0.0830 0.0755 0.0760 0.0750 0.0700 0.0765 0.0775 0.0805 0.0830 0.0765

    12
0.0775

Andy

> From: mirage sell
>
> Hi everyone, I need help.
> I want to have a "uniform" kind distribution. When I used
> sample function I
> got almost twice many zeros compared to other numbers. What's
> wrong with my
> command ?
>
> temp <-sample(0:12, 2000, replace=T,prob=(rep(1/13,13)))
> hist(temp)
>
> Thanks in advance,
>
> Taka,
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Mar 11 14:20:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:42 EST