[R] Problem with strucchange package

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Wed Jul 2 21:56:20 CEST 2008


On Wed, 2 Jul 2008, tolga.i.uzuner at jpmorgan.com wrote:

> Dear R Users,
>
> I am attempting to use the strucchange package but get an error which is
> difficult to decipher.
>
> I get the following error with breakpoints:
>
>> bp<-breakpoints(regr[,1]~regr[,2]+regr[,3])
> Error in my.RSS.table[as.character(i), 3:4] <- c(pot.index[opt],
> break.RSS[opt]) :
>  nothing to replace with

I've seen this happening when something about the data formatting was not 
right. Maybe it is because of:

> regr is a zoo object with three columns.

Unfortunately, breakpoints() does not yet support "zoo" objects. This has 
been on my todo list for some time but it's still not there. The
recommended workaround is to store the time index elsewhere and query that 
separately, e.g.,

## separate data
mydata <- as.data.frame(regr)
mytime <- time(regr)

## call breakpoints (assuming that y, x1, x2 are the column names of regr)
bp <- breakpoints(y ~ x1 + x2, data = mydata)

## query breakpoints
summary(bp)
breakpoints(bp)
## plot...etc.

## match with time index
mytime[breakpoints(bp)$breakpoints]

Hopefully that solves your problem. Depending on the size of your data 
set, it might also help to set "h" to a more reasonable value than the 
default in breakpoints().

hth,
Z

> Happy to provide all the data so
> one can replicate this but it is  lengthy so I am posting this way in case
> this is a common issue.
>
> This is on R version 2.7.0, strucchange 1.2-3 and zoo 1.5-3.
>
> Thanks in advance,
> Tolga
>
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communication may be intended as an offer or
> solicitation for the purchase or sale of such fund(s).  All market
> prices, data and other information are not warranted as to
> completeness or accuracy and are subject to change without notice.
> Any comments or statements made herein do not necessarily reflect
> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to UK legal entities.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
>



More information about the R-help mailing list