On Wed, 14 Sep 2011, R. Michael Weylandt wrote:
If by gbreakpoints, you simply mean breakpoints (I'm not familiar with the
package so this is an honest point of ambiguity from me),
It is really gbreakpoints() although it is not quite clear how this was
accessed. gbreakpoints() is an unexported function from the "fxregime"
package which is built on top of "strucchange". The reason is that the
interface may change in the future and there is a function fxregimes()
that is exported.
In any case: There are extractor functions for objects returned by
breakpoints() and fxregime() (and some even gbreakpoints()), most of which
take an optional "breaks" argument, e.g., for looking at the 2-break
solution
## estimated parameters
coef(res, breaks = 2)
## estimated breakpoints on original time scale
breakdates(res, breaks = 2)
## estimated breakpoints in numbers of observations
breakpoints(res, breaks = 2)
breakpoints(res, breaks = 2)$breakpoints
As pointed out in the manual pages, many of these are documented in
Zeileis A., Kleiber C., Kraemer W., Hornik K. (2003), Testing and Dating
of Structural Changes in Practice, _Computational Statistics and Data
Analysis_, *44*, 109-123. doi:10.1016/S0167-9473(03)00030-6.
But since 2003 even more functionality became available. See the examples
sections for illustrations.
hth,
Z
the documentation
says the following:
Value
An object of class "breakpoints" is a list with the following elements:
breakpointsthe breakpoints of the optimal partition with the number of
breaks specified (set to NA if the optimal 1-segment solution is reported),
RSSthe associated RSS,nobsthe number of observations,nregthe number of
regressors,callthe function call,datatspthe time series properties tsp of
the data, if any, c(1/nobs, 1, nobs)otherwise. This suggests that you can
access the breakpoints in one of three ways
res$breakpoints or res[[1]] or res[["breakpoints"]]
Though without data and a reproducible example I can't guarantee this is
what you are looking for. More generally, you should look at ?Extract to see
how to get values from R objects. Whatever getting started with R material
you (should have) read probably dealt with this topic in the context of the
lm() function, but the mechanics are the same for most everything.
Hope this helps,
Michael Weylandt
On Wed, Sep 14, 2011 at 4:16 AM, Vikram Bahure
<economics.vik...@gmail.com>wrote:
Hi,
I am new to R. I am using strucchange to get the breakpoints in time series
dataset. So the problem I am facing is: I want to link the result generated
by the breakpoints to further analysis (for eg. generating volatility for
each group). The result is in following form:
---------------------------------------
res <- gbreakpoints(GDP.new ~ 1,data=a,h=2,breaks=6)
res
Optimal 7-segment partition for `lm' fit:
Call:
gbreakpoints(formula = GDP.new ~ 1, data = a, h = 2, breaks = 6)
Breakpoints at observation number:
10 19 25 33 44 53
Corresponding to breakdates:
1960 1969 1975 1983 1994 2003
---------------------------------------
It would be helpful if you can throw some light on how to access the data
stored in the breakpoints result instead of manually accessing it.
Regards
Vikram Bahure
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
______________________________________________
R-help@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.