2016-09-21 13 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

덕분에 많이, 지금은 그것을 얻을! –