search for: dchisq

Displaying 20 results from an estimated 73 matches for "dchisq".

Did you mean: chisq
2009 Jan 17
4
Where to find the source codes for the internal function in stats package
Dear all, I want to see the source codes for "dchisq(x, df, ncp=0, log = FALSE)", but cannot find it. I input "dchisq" in the R interface, and then enter, the following message return: > dchisq /*****************************************************/ function (x, df, ncp = 0, log = FALSE) { if (missing(ncp)) .Internal(dch...
2000 Dec 14
2
Accuracy problem in dchisq for non-central chi-squared
Hi, I think I have identified a inaccuracy in dchisq when the non-centrality parameter is non-zero and large. Here's a little test: sys.dchisq.test <- function(N = 100000,mean = 0) { z <- rnorm(N,mean = mean, sd = 1) x <- z^2 xmin <- min(x) xmax <- max(x) br <- seq(xmin,xmax,length = 101) dbr <- br[2]-br[1] his...
2010 Aug 17
2
plotting functions of chi square
Hi! This is going to be a real newbie question, but I can't figure it out. I'm trying to plot densities of various functions of chi-square. A simple chi-square plot I can do with dchisq(). But e.g. chi.sq/degrees of freedom I only know how to do using density(rchisq()/df). For example: plot(1, type="n", xlab="", ylab="", xlim=c(0,2), ylim=c(0,7)) for (i in c(10,50,100,200,500)){ lines(density(rchisq(100000,i)/i)) } But even with 100,000 samples th...
2003 Apr 13
2
Peculiarity in non-central qchisq for ncp > 294.92 ...
Hello all, Here's my query: Running R 1.6.2 on FreeBSD 5.0, and on WinXP, and I find that the following hangs the process: dchisq(alpha=0.01, df=1, ncp=295) but it does work for ncp < 294.92. Is this general? Best wishes to all, Andrew Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uida...
2003 Sep 03
3
plotting a distribution curves
Hi, is there a way to plot distribution curves (say normal or chi sq etc) from within R? For example I looked up the *chisq family of functions but I'm not sure as to how I would use them to generate a plot of the chi sq distribution (for arbitrary d.o.f). Thanks, ------------------------------------------------------------------- Rajarshi Guha <rajarshi at presidency.com>
2008 Nov 07
4
chi square table
Hi, How do we get the value of a chi square as we usually look up on the table on our text book? i.e. Chi-square(0.01, df=8), the text book table gives 20.090 > dchisq(0.01, df=8) [1] 1.036471e-08 > pchisq(0.01, df=8) [1] 2.593772e-11 > qchisq(0.01, df=8) [1] 1.646497 > nono of them give me 20.090 Thanks, cruz
2005 Dec 13
8
superimpose density line over hist
Hi all, I'm trying to superimpose a rchisq density line over a histogram with something like: hist(alnlength) lines(density(rchisq(length(alnlength), 4)),col="red") But the rchisq line won't appear anywhere, Anyone knows what I am missing here? Thanks in advance, Albert.
2007 Oct 24
1
vectorized mle / optim
...nd short example summarizing the problem: -------------------------------- example 1 ------------ 8< ---------------------- library(stats4) data <- rnorm(100,0,1) lik1 <- function(m, v, data) { N <- length(data) lik.mean <- dnorm(mean(data), m, sqrt(v/N), log=T) lik.var <- dchisq(N*var(data)/v, N-1, log=T) return(-lik.mean - lik.var) } ml.result <- mle(lik1, start=list(m=2, v=2), fixed=list(data=data)) summary(ml.result) --------------------------------------------------------------------------------------- This works perfectly (except that the default algorithm somet...
2008 Jan 09
3
likelihood from test result
...atistic distribution that was used to compute the p-value. It seems the only way to write such a function is to manually assign each test its statistic's distribution, e.g., like this: FUN <- if(names(x$statistic) == "t") dt else if(names(x$statistic) == "X-squared") dchisq # etc. Is there a general S3 or S4 class other than "htest" that would better accommodate such extraction of distributions or likelihoods? I would also appreciate any suggestions for strategies or contributed packages that may facilitate automation. For example, would the "distrTEst...
2008 Oct 25
2
how to plot chi-square distribution in the graph
if i want to plot the chi-square distribution with a different degree of freedom how can i plot it in the graph?Sometimes i plot the histogram and cut it in a lot of piece.It's distribution like a chi-square.So i want to plot the chi-square with a different degree of freedom to compare it . -- View this message in context:
2008 Aug 21
2
Help Regarding 'integrate'
I have an R function defined as: f<-function(x){ return(dchisq(x,9,77)*((13.5/x)^5)*exp(-13.5/x)) } Numerically integrating this function, I observed a couple of things: A) Integrating the function f over the entire positive real line gives an error: > integrate(f,0,Inf) Error in integrate(f, 0, Inf) : the integral is probably divergent B) Increasing th...
2004 Dec 17
2
Doubts about chi-square distribution
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! And I have a couple of doubts: 1) line 51 #curve(dchisq(x, n-1), add = T, col = 'red' I think that it is correct, but the function no match with the observed distribution. curve(dchisq(x, n), add = T, col = 'red') matches, so, what is wrong? 2) Plot I would like to distance the Ylabel from the left limit of the screen, i...
2008 Jul 16
4
Likelihood ratio test between glm and glmer fits
...d glmer fits x2<--2*(logLik(ph.fit.2)-logLik(ph.fit.3)) > ML 79.60454 attr(,"nobs") n 45243 attr(,"nall") n 45243 attr(,"df") [1] 14 attr(,"REML") [1] FALSE attr(,"class") [1] "logLik" #Get the associated p-value dchisq(x2,14) ML >5.94849e-15 Which looks like an improvement in model fit to me. Am I seeing this correctly or are the two models even able to be compared? they are both estimated via maximum likelihood, so they should be, I think. Any help would be appreciated. Corey Corey S. Sparks, P...
2006 Jan 24
0
Relating Spectral Density to Chi-Square distribution
...chi-square. >help.search("chi square") . provided a list of potentials, of which Chisquare() seemed to fit because it mentioned the distribution. >?Chisquare . provided the documentation, which shows four functions and their descriptions. I've assumed that I need too use dchisq() for my purposes, so that the fitted distribution would be: [assuming the power returned by spec.pgram() ARE regarded as quantiles.] >plot(dchisq(PSD$spec, df=2)) . but the values are not between (0,1). >plot(PSD$freq, pchisq(PSD$spec, df=2, lower.tail=F)) . looks better because va...
2009 Nov 20
0
Guardar gráficos en eps con letras griegas en las leyendas
...uot;topleft",substitute(chi)) que no funciona. El problema ahora es que al abrir el .eps tiene las letras griegas, pero al compilarlo dentro de un archivo latex se vuelven latinas. Pero supongo que me tendré que ir a un foro de LaTex a preguntar. Por si sirve para algo, mi función es: curve(dchisq(x, 2), 0, 16,ylab="",lwd=2) curve(dchisq(x, 4), 0, 16, add=TRUE, lwd=2,lty=2) curve(dchisq(x, 8), 0, 16, add=TRUE, lwd=2,lty=3) text(0.7,0.5,"n=2") text(4.5,0.15,"n=4") text(12,0.07,"n=8") legend("c...
2008 Aug 21
1
pnmath compilation failure; dylib issue?
...cOSX10.4u.sdk -mmacosx- version-min=10.4 -std=gnu99 -dynamiclib -Wl,- headerpad_max_install_names -mmacosx-version-min=10.4 -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/ lib -o pnmath.so bd0.o beta.o chebyshev.o choose.o d1mach.o dbeta.o dbinom.o dcauchy.o dchisq.o dexp.o df.o dgamma.o dgeom.o dhyper.o dlnorm.o dlogis.o dnbeta.o dnbinom.o dnchisq.o dnf.o dnorm.o dnt.o dpois.o dt.o dunif.o dweibull.o fmax2.o fmin2.o ftrunc.o gamma.o gamma_cody.o i1mach.o imax2.o imin2.o lbeta.o lgamma.o lgammacor.o mlutils.o pbeta.o pbinom.o pcauchy.o pchisq.o pexp.o...
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
2005 Jan 21
0
R: chi-Squared distribution in Friedman test
Hi, pchisq -> distribution function dchisq -> density function pval is the area under the curve, to calculte it you use distribution function which is the integral of density function. See: http://www.itl.nist.gov/div898/handbook/eda/section3/eda362.htm http://mathworld.wolfram.com/DistributionFunction.html f(x) density function F(x)...
2007 Oct 06
2
plot the chi-square distribution for n=1 through 10, on one plot
Dear help list. I would like to plot the chi-square distribution for n=1 through 10, on one plot. How do I go about doing that? I know how to plot one chi-square (using curve() for example), but plotting 10 on one plot, that is too difficult for me. I greatly appreciate your help. -- fb isabellesup at fastmail.fm --