Hello, I want to use the quantile function so I read the doc but I don't understand with this> qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1))[1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53 63550.14 63619.68 [18] 63707.24 63837.16 Can you help me please? _____________________________________________________________________________ l [[alternative HTML version deleted]]
elyakhlifi mustapha wrote:> Hello, > I want to use the quantile function so I read the doc but I don't understand with this > > >> qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1)) >> > [1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53 63550.14 63619.68 > [18] 63707.24 63837.16 > > Can you help me please? >Nothing wrong with the above provided that you have 63251degrees of freedom. What is "don", and why do you use the length of it?> > _____________________________________________________________________________ > > l > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
elyakhlifi mustapha wrote:> > Hello, > I want to use the quantile function so I read the doc but I don't > understand with this > >> qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1)) > [1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 > 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53 > 63550.14 63619.68 > [18] 63707.24 63837.16 >I don't understand what your question is. I infer that don is a vector of length 63252: 1. find df to match the first result in the vector;> uniroot(function(d) pchisq(62667.11,df=d)-0.05, c(1000, 1e9))$root [1] 63251 $f.root [1] -1.483395e-11 $iter [1] 28 $estim.prec [1] 0.0001207690 recreate the results:> qchisq(seq(0.05,0.95,by=0.05),df=63251)[1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 63160.27 [9] 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53 63550.14 [17] 63619.68 63707.24 63837.16 So what's the problem? Ben Bolker -- View this message in context: http://www.nabble.com/chi2-tf4600185.html#a13134124 Sent from the R help mailing list archive at Nabble.com.
Elyakhlifi Mustapha wrote:> > I want to use the quantile function so I read the doc but I don't > understand with this > > > qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1)) > [1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 > 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 > 63490.53 63550.14 63619.68 [18] 63707.24 63837.16 > > Can you help me please? >Notice that, if you want adequate help, you must provide all information. You didn't give don, so we can't reproduce the output. However, since qchisq(0.5, df) for large df is very close to df, it's possible to infer that length(don)-1 = 63251. If you plot dchisq(x, df=63251) (for example: x <- ((-1000):1000) + 63251 plot(x, dchisq(x, df=63251), type="l") or y <- rchisq(10000, df=63251) hist(y) or any other way to view the probability density function), it's easy so see that chi2 for large n is normal-like, with mean close to df, and standard deviation close to sqrt(df). Alberto Monteiro
Oops... Check... http://en.wikipedia.org/wiki/Chi-square_distribution The Chi-square distribution for _any_ df has mean = df and variance = 2df, so for large df, it's approximately a normal distribution with mean = df and sd = sqrt(2 df) [and not sqrt(df) as I wrote in a previous message that, probably, will appear after this one - Murphy rulez] Alberto Monteiro
On 10-Oct-07 10:59:43, elyakhlifi mustapha wrote:> Hello, > I want to use the quantile function so I read the doc but I don't > understand with this > >> qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1)) > [1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39 > 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53 > 63550.14 63619.68 > [18] 63707.24 63837.16 > > Can you help me please?What that tells *me* is that 'don' is a quite long vector: you should find that length(don) = 63252 = 63251+1 as I verified using pchisq(): pchisq(62667.11,63251) [1] 0.04999935 pchisq(63837.16,63251) [1] 0.9499995 So 62667.11 is the value such that, with 63251 degrees of freedom, Prob(chisq <= 62667.11) = 0.05 Prob(chisq <= 63837.16) = 0.95 (and similarly for the other values in your list). The function qchisq() is simply the inverse of pchisq(): where pchisq(x,df) tells you Prob(chisq <= x) with df degrees of freedom, for given x, qchisq(p,df) tells you what value of x will give Prob(chisq <= x) = p for a given value of p. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 10-Oct-07 Time: 13:05:19 ------------------------------ XFMail ------------------------------