[R] nmle for time of structural change?

Spencer Graves spencer.graves at pdf.com
Thu Nov 16 03:29:31 CET 2006


Hi, All: 

      Does 'nlme' require the nonlinear function to be differentiable?  
I'm fitting structural change models to many related time series, and 
I'd like to improve the estimates of the change point times through some 
type of pooling.  Unfortunately, I've so far been unable to get 'nlme' 
to work for me.  The following toy example is the closest I've come to 
what I want using 'nlme': 

library(nlme)
tstDF5 <- data.frame(t.=rep(1:5, 3), subj=rep(1:3, e=5),
     y=c(rep(0:1, c(1,4)), rep(0:1, c(2,3)),
         rep(0:1, c(3,2)) ) )
breakpoint0seg2t <- function(t., lT){
  t1 <- 5*plogis(-lT)
  ((t.<=t1)+(t1<t.))
}
tstFit <- nlme(y~breakpoint0seg2t(t., lT1),
    data=tstDF5, fixed=lT1~1,
    random=list(subj=pdDiag(l1~1)), start=0 )

Error in chol((value + t(value))/2) : the leading minor of order 1 is 
not positive definite

      The function 'breakpoint0seg2t' is constant except at the data 
points, where it is discontinuous.  Is this error message generated by 
the fact that the first derivative of 'breakpoint0seg2t' is 0 almost 
everywhere?  If yes, what are the options for getting around this? 
    
      The real problem behind this toy example involves fitting either 
step functions or linear or quadratics in time with any number of 
breakpoints.  I'm currently estimating the required parameters using the 
'strucchange' package.  That work, but I'm having trouble with this 
enhancement. 

      Thanks,
      Spencer Graves



More information about the R-help mailing list