2016-09-21 3 views
1

ブレークポイントは、F統計を最大化する観測に対応する必要がありますが、F統計とブレークのタイミングとの間に意味のある関連付けはありません。何が間違っていますか?strucchangeパッケージ内のブレークポイントとF統計

y <- c(rnorm(30), 2+rnorm(20)) # 1 breakpoint 
f <- Fstats(y ~ 1)    # calculate F statistics 
f$breakpoint      # breakpoint Fstats suggests 
which(f$Fstats == max(f$Fstats)) # observation with max F statistics 
order(f$Fstats)     # observations ordered by F statistics 

分かるように、ブレークポイントの観察は、最も高いF統計値を伴う観察ではない。

答えて

1

yはクラスtsではありません。だから出力は少し奇妙なtsのデータになり、残念ながらそれを解釈できませんでした。

set.seed(1) 
y <- c(rnorm(30), 2+rnorm(20)) 
ts.y <- ts(y, start = 1, frequency = 1) # change `y` into class `ts` 

ts.f <- Fstats(ts.y ~ 1) 

ts.f$breakpoint # [1] 30 
ts.f$Fstats 
# Time Series: 
# Start = 7  # this means ts.f$Fstats[1] is 7th 
which(ts.f$Fstats == max(ts.f$Fstats)) # [1] 24 # ts.f$Fstats[24] is 30th 

plot(ts.f) 
lines(breakpoints(ts.f)) 

enter image description here

+0

おかげで多くが、今私はそれを得ます! –