[R] F-test question
Ingo Wardinski
ingo at gfz-potsdam.de
Tue Aug 13 13:36:18 CEST 2013
G'day
I try do compute some F-statistics of a singular spectrum analysis of a
timeseries sv
I run:
> require(Rssa)
> s <- ssa(sv)
> summary(sv)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-4.238 2.761 6.594 6.324 10.410 15.180
> r1 <- reconstruct(s,groups = list(1:5))
> r2 <- reconstruct(s,groups = list(1:6))
> SSE_M1 <- sum(residuals(r1)^2)
> SSE_M2 <- sum(residuals(r2)^2)
> df.num <- r1$df - r2$df
> df.den <- r2$df
> F <- ((SSE_M2 - SSE_M1) / df.num) / (SSE_M1 / df.den)
and eventually
> p.value <- 1 - pf(F, df.num, df.den)
Error in pf(F, df.num, df.den) :
Non-numeric argument to mathematical function
> summary(df.num)
Min. 1st Qu. Median Mean 3rd Qu. Max.
> summary(df.den)
Length Class Mode
0 NULL NULL
> summary(F)
Min. 1st Qu. Median Mean 3rd Qu. Max.
I need to compute the p.value, but something is going wrong, and I can't
see what.
Any help would be very much appreciated
ingo
More information about the R-help
mailing list