Quantcast

How to calculate chi sqaure value from statistical value and degrees of freedom?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to calculate chi sqaure value from statistical value and degrees of freedom?

Manish Gupta
Hi,

How to calculate chi sqaure p value for given statistical value and degrees of freedom.

Input :
x = statistical value
d = degrees of freedom
output:
p value = ?

Regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to calculate chi sqaure value from statistical value and degrees of freedom?

Özgür Asar
Hi,

Try

pchisq(q,df)

available at help(Chisquare)

Ozgur
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to calculate chi sqaure value from statistical value and degrees of freedom?

Manish Gupta
Hi,

My input is chi square statistical value and degrees of freedom. But i m getting different p values with the above formula.

I double checked my values with the below calculator.

http://vassarstats.net/tabs.html#csq

Pls help me out.  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to calculate chi sqaure value from statistical value and degrees of freedom?

Özgür Asar
Hi,

Actually, pchisq(q,df) calculates the cumulative distribution function by default.

To calculate the p-value, you can use either

1-pchisq(q,df)

or

pchisq(q,df,lower.tail=FALSE)

PS: I checked, the p value yielded by R and the calculator for which you give a link, for some "q" and "df" values, and these two are same.

Best
Ozgur
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to calculate chi sqaure value from statistical value and degrees of freedom?

Rui Barradas
In reply to this post by Manish Gupta
Hello,

You are computing the lower tail value, for chi-squared tests it's
probably the upper tail you want.

p.val1 <- 1 - pchisq(Stat, df)
p.val2 <- pchisq(Stat, df, lower.tail=FALSE)
p.val1 == p.val2

Hope this helps,

Rui Barradas

Em 06-06-2012 02:31, Manish Gupta escreveu:

> Hi,
>
> My input is chi square statistical value and degrees of freedom. But i m
> getting different p values with the above formula.
>
> I double checked my values with the below calculator.
>
> http://vassarstats.net/tabs.html#csq
>
> Pls help me out.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-calculate-chi-sqaure-value-from-statistical-value-and-degrees-of-freedom-tp4632385p4632467.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Loading...