tho_mi
tho_mi

Reputation: 718

Breakpoints and F statistics in strucchange package

As far as I know the breakpoint should correspond to the observation which maximizes the F statistics, but I can't see any meaningful association between the F statistics and the timing of the break. What do I get wrong?

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

As can be seen the observation of the breakpoint is not the observation with the highest F statistics.

Upvotes: 1

Views: 447

Answers (1)

cuttlefish44
cuttlefish44

Reputation: 6776

Your y is not class ts. So the output became a bit curious ts data and unfortunately you failed to interpret it.

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

Upvotes: 1

Related Questions