[R] Function Fstats and p value

Achim Zeileis Achim.Zeileis at uibk.ac.at
Fri Feb 12 14:27:23 CET 2010


On Fri, 12 Feb 2010, sebastien wrote:

> Hello,
>
> I used the function Fstats (in the package strucchange) and would like to
> transform the F probability given by Fstats in P value. This transformation
> can be made while making a plot, but I need to have the numerical P value
> which are ploted... and I can't find out how to do.
>
> Here a is an exemple, to plot the P value.
>
> let's take data as a array
>
> fs <-fstats(data ~ 1, from = 4, to = length(data)-4)
> plot(fs,pval=TRUE)

This plot simply takes the Chi-squared p-values, i.e.

   pchisq(fs$Fstats, fs$nreg, lower.tail = FALSE)

and plots them. The boundary is then the adjusted critical value (and 
_not_ 5%).

If you want to obtain the p-value for the maximum, you can do

   pvalue.Fstats(max(fs$Fstats), k = fs$nreg, lambda = fs$par)

or iterate that to obtain the adjusted sequence of p-values via

   sapply(as.vector(fs$Fstats), pvalue.Fstats, k = fs$nreg,
     lambda = fs$par)

More details about the general approach and a few comments about the 
p-values are also in

   vignette("strucchange-intro", package = "strucchange")

hth,
Z

> Thank you for your help,
> Seb
> -- 
> View this message in context: http://n4.nabble.com/Function-Fstats-and-p-value-tp1478478p1478478.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list