Displaying 20 results from an estimated 237 matches for "pchisq".
Did you mean:
chisq
2009 Jan 19
2
pchisq error
Dear R experts,
I'm trying to call 'pchisq' from within a C subroutine. The following
error is returned:
** NON-convergence in pgamma()'s pd_lower_cf() f= nan.
This error message is not printed the first time I call 'pchisq' from
the C subroutine, but the second time or the next time I call 'pchisq'
from within...
2007 Jan 31
2
Bug in 'pchisq' for x=0.0 (PR#9485)
The function 'pchisq' from the 'stats' library gives a wrong result if the
argument equals exactly zero:
# Upper tail of central 1-df chi^2 distribution
> pchisq(1 , 1, ncp=0, lower.tail = F, log.p = FALSE)
[1] 0.3173105
> pchisq(0.5 , 1, ncp=0, lower.tail = F, log.p = FALSE)
[1] 0.4795...
2008 Jan 07
2
chi-squared with zero df (PR#10551)
Full_Name: Jerry W. Lewis
Version: 2.6.1
OS: Windows XP Professional
Submission from: (NULL) (24.147.191.250)
pchisq(0,0,ncp=lambda) returns 0 instead of exp(-lambda/2)
pchisq(x,0,ncp=lambda) returns NaN instead of exp(-lambda/2)*(1 +
SUM_{r=0}^infty ((lambda/2)^r / r!) pchisq(x, df + 2r))
qchisq(.7,0,ncp=1) returns 1.712252 instead of 0.701297103
qchisq(exp(-1/2),0,ncp=1) returns 1.238938 instead of 0
2004 Jul 16
2
inconsistency in pchisq (PR#7099)
Full_Name: Richard Mott
Version: 1.9.0
OS: Windows XP
Submission from: (NULL) (81.178.233.208)
Shouldn't these give the same answer?
> pchisq(67.60644,df=1,lower.tail=F,ncp=0)
[1] 3.219647e-15
> pchisq(67.60644,df=1,lower.tail=F)
[1] 1.996145e-16
>
2003 Feb 14
1
FW: [Fwd: Re: [S] Exact p-values]
...----
> > From: Spencer Graves [SMTP:spencer.graves at PDF.COM]
> > Sent: Thursday, February 13, 2003 6:12 PM
> > To: Jose Mar?a Fedriani Laffitte
> > Cc: s-news at lists.biostat.wustl.edu
> > Subject: Re: [S] Exact p-values
> >
> >
> > Try ( 1-pchisq(29.8, df=1)): With S-Plus 6.1, I got 4.78992e-008.
> >
> > By the way, the distribtion functions in R have more
> arguments.
> > For example, pchisq(29.8, df=1, lower.tail=F) produces the same
> > answer, and pchisq(29.8, df=1, lower.tail=F, log=T) produc...
2006 Dec 01
2
Non central chi squared bug (PR#9406)
Full_Name: Alan Bain
Version: 2.4.0
OS: XP
Submission from: (NULL) (155.140.122.227)
Code for pnchisq contains following
if (tSml) {
if (x> f+ theta+ 5*sqrt(2*(f+2*theta) ))){
return 1.; /* better than 0 --- but definately FIXME */
}
}
This needs to check which tail has been requested; it is only correct if the
default lower_tail=1 has been requested; for upper tail should return 0
2008 Aug 10
1
(Un-)intentional change in drop1() "Chisq" behaviour?
Dear List,
recently tried to reproduce the results of some custom model selection
function after updating R, which unfortunately failed. However, I
ultimately found the issue to be that testing with pchisq() in drop1()
seems to have changed. In the below example, earlier versions (e.g. R
2.4.1) produce a missing P-value for the variable x, while newer
versions (e.g. R 2.7.1) produce 0 (2.2e-16).
I would assume that the former is more appropriate, so I was just
curious if this is an intentional chang...
2002 Oct 14
2
Vector of quantiles
I have a quick question which is very simple but I seem to have a mental
block!
I'm using the pchisq function to specify a Chi Squared distribution with 9 df
which I'm then going to use in the Kolmogorov-Smirnov Test to test some
simulated values.
so simply: pchisq(q, df=9)
I know that q is the vector of quantiles but could anybody tell me what
exactly this vector needs to contain?
Many...
2005 Oct 18
6
p-value calculation
hello everybody
i'm very new at using R so probably this is a very stupid question.
I have a problem calculating a p-value. When i do this with excel i
can use the method CHIDIST for 1.2654 with 1 freedom degree i get the
answer 0.261
i just want to do the same thing in R but i can't find a method.
can somebody help me
friendly regards
richard
2003 Feb 14
0
FW: [Fwd: Re: [S] Exact p-values]
...s at PDF.COM]
> >> > Sent: Thursday, February 13, 2003 6:12 PM
> >> > To: Jose Mar?a Fedriani Laffitte
> >> > Cc: s-news at lists.biostat.wustl.edu
> >> > Subject: Re: [S] Exact p-values
> >> >
> >> >
> >> > Try ( 1-pchisq(29.8, df=1)): With S-Plus 6.1, I got 4.78992e-008.
> >> >
> >> > By the way, the distribtion functions in R have more
> >>arguments.
> >> > For example, pchisq(29.8, df=1, lower.tail=F) produces the same
> >> > answer, and pchisq...
2007 Oct 10
5
chi2
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?
2005 Aug 04
2
p-values
...le).
In their book they calculate Durbin's statistic, D1, a dispersion
statistics, D2, and a residual. P-values for each statistic is
calculated from a chi-square distribution and also Monte Carlo p-values.
I have found similar p-values based on the chi-square distribution by
using:
> pchisq(12, df= 6, lower.tail=F)
[1] 0.0619688
> pchisq(5.1, df= 6, lower.tail=F)
[1] 0.5310529
Is there a way to calculate the equivalent Monte Carlo p-values?
The values were 0.02 and 0.138 respectively.
The use of the approximate chi-square probabilities for Durbin's test
are considered not...
2006 Mar 02
1
calling R's library using C
Hi,
Thanks, everyone for all the help! So, here is my calling function in C
(called
test.c):
#include<stdio.h>
#include<stdlib.h>
#include<Rmath.h>
int main(void) {
printf("%f \n",pchisq(2.,7., 1, 0));
printf("%f \n",pnchisq(2.,7.,0., 1, 0));
return EXIT_SUCCESS;
}
I compile using:
gcc test.c -I/usr/lib/R/include -L/usr/lib/R/lib -lm -lR
However, running
./a.out
gives me:
1.000000
0.040160
The first is wrong, but the second non-central is...
2010 Jul 07
1
Different goodness of fit tests leads to contradictory conclusions
...
> hosmerlem <- function (y, yhat, g = 10)
{
cutyhat <- cut(yhat, breaks = quantile(yhat, probs = seq(0, 1, 1/g)), include.lowest = T)
obs <- xtabs(cbind(1 - y, y) ~ cutyhat)
expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat)
chisq <- sum((obs - expect)^2/expect)
P <- 1 - pchisq(chisq, g - 2)
c("X^2" = chisq, Df = g - 2, "P(>Chi)" = P)
}
> hosmerlem(no.NA$repcnd, fitted(mod.fit))
X^2 Df P(>Chi)
7.8320107 8.0000000 0.4500497
> # Option 2 - Hosmer–le Cessie omnibus l...
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
2012 Mar 04
1
p-value from GLM
Dear all,
I am fitting a GLM similar to
library(MASS)
anorex.1 <- glm(Treat~Postwt+Prewt,family = binomial, data = anorexia)
I have found two ways of computing the p-value of the fitted model:
pval1 <- 1-pchisq(anorex.1$deviance,anorex.1$df.residual)
pval2 <- 1-pchisq(anorex.1$null.deviance - anorex.1$deviance,
anorex.1$df.null - anorex.1$df.residual)
pval2 is testing LR chi2 from the null model, but what does pval1 says?
Many thanks in advance,
Dunia
[[alternative HTML version de...
2010 Jul 09
1
Appropriate tests for logistic regression with a continuous predictor variable and Bernoulli response variable
...t as a goodness of fit (as suggested by a kind “R-helper” previously). To test whether the predictor (svl, or body size) has significant effect on predicting whether or not a female snake is pregnant, I used the differences between null deviance and residual deviance using a code as following:
1-pchisq(mod.fit$null.deviance - mod.fit$deviance, mod.fit$df.null - mod.fit$df.residual)
Could anyone tell me whether I did the test properly? I did this test because I thought Wald test/z score listed in the output from "summary(mod.fit)" is not appropriate for a kind of data I have. Does R h...
2005 Apr 22
1
Infinite degrees of freedom for F-distribution
...ons recognize that df=Inf is equivalent to the
standard normal distribution:
> pt(1,df=Inf)
[1] 0.8413447
> pnorm(1)
[1] 0.8413447
On the other hand, pf() will accept Inf for df1, but returns the wrong result:
> pf(1,df1=Inf,df2=1)
[1] 1
whereas the correct limiting value is
> pchisq(1,df=1,lower.tail=FALSE)
[1] 0.3173105
pf() returns NaN when df2=Inf:
> pf(1,df1=1,df2=Inf)
[1] NaN
Warning message:
NaNs produced in: pf(q, df1, df2, lower.tail, log.p)
although the correct value is available as
> pchisq(1,df=1)
[1] 0.6826895
Gordon
> version
_
platfor...
2010 Mar 14
3
likelihood ratio test between glmer and glm
...he log-likelihoods of the glm model and of the glmer model as follows:
lrt <- function (obj1, obj2){
L0 <- logLik(obj1)
L1 <- logLik(obj2)
L01 <- as.vector(- 2 * (L0 - L1))
df <- attr(L1, "df") - attr(L0, "df")
list(L01 = L01, df = df, "p-value" = pchisq(L01, df, lower.tail = FALSE)) }
gm0 <- glm(cbind(female,male)~date,family = binomial, data = liz3)
gm1 <- glmer(cbind(female,male)~date+(1|dam),family=binomial,data= liz3)
lrt(gm0, gm1)
and I have compared the deviances as follows:
(d0 <- deviance(gm0))
(d1 <- deviance(gm1))
(LR...
2007 May 23
0
Replicated LR goodness-of-fit tests, heterogeneity G, with loglm?
...late the G for each level of tran (likelihood
ratios)
G = vector()
for (i in levels(tran)) {
obsi =
obscounts[tran==i]
expi =
expcounts[tran==i]
G[i] =
2*sum((obsi*log(obsi/expi)))
}
dfs = rep(max(as.integer(levels(cov)))-1, max(as.integer(levels(cov))))
probs = pchisq(G, dfs, lower.tail=F) #and the lower tail probability of the G
#get a weighted
average for the pooled expectations
weightexp = list()
weights = vector()
for (i in
levels(tran)) {
expi = expprop[tran==i]
lengi =
tleng[as.integer(i)]
counti =
sum(obscou...