[R] Doubts about chi-square distribution

Liaw, Andy andy_liaw at merck.com
Fri Dec 17 16:31:38 CET 2004


> From: Peter Dalgaard
> 
> José Cláudio Faria <joseclaudio.faria at terra.com.br> writes:
> 
> > Dear list,
> > 
> > For educational purposes I have been working with the script below.
> > 
> > I have a observation:
> > 
> >    line 31
> > 
> >    #CScal[i] = (amo^2)  # IT IS WRONG, I KNOW, BUT IT MAKE 
> R TO CRASHES!
> > 
> >    I'm thinking this is a possible bug in the R!
> 
> Possibly, but ***WHICH R?*** 

It happens with R-2.0.1 pre-compiled binary from CRAN for Windows, on XPPro
SP2.  Weird...

BTW, I'd recommend Jose to do something like:

simCS <- function(Mpop=0, Vpop=1, N=1e4, n=10, sr=1e4, nchist=150) {
    pop = rnorm(N, Mpop, sqrt(Vpop))  # pop~N(Mpop,Vpop)
    CScal <- replicate(sr, sum(sample(pop, n, replace=TRUE)^2))
    [insert the rest of the code here]
}

Andy



> I see a segmentation fault on 1.9.1 on i386 but an error message with
> 2.0.1 on Opteron.
>  
> (We did remember to tell you to include full version information in
> the posting guide, did we not?)
> 
> -- 
>    O__  ---- Peter Dalgaard             Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: 
> (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: 
> (+45) 35327907
> 
> ______________________________________________
> R-help at 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
> 
>




More information about the R-help mailing list