[R] SETAR Estimation

2005-07-26 Thread ekhous
Dear R-helpers,

I was wondering if anyone has or knows someone who might have an implementation
of algorithm for estimating SETAR models including the lag-order. For some
reason my code gives me a bit wrong results. I am fighting with it for a week
and cannot bring it down.
Thanks a million in advance,
Sincerely,

Evgueni

McGill University
Department of Economics

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] nls

2005-07-19 Thread ekhous
Dear R-helpers,

I am trying to estimate a model that I am proposing, which consists of putting
an extra hidden layer in the Markov switching models. In the simplest case the
S(t) - Markov states - and w(t) - the extra hidden variables - are independent,
and w(t) is constant. Formally the model looks like this:
y(t)=c(1,y[t-1])%*%beta0*w+c(1,y[t-1])%*%beta1*(1-w). So I ran some simulations
to obtain the y's, and I am putting it into the nls:

res-nls(y~(a+b*x)*w+(c+d*x)*(1-w),start=list(a=1,b=0.3,c=-1,d=-0.2,w=0.5))

and the starting parameter values are similar to the ones I used for
simulations, however I am getting

Error in nlsModel(formula, mf, start) : singular gradient matrix at initial
parameter estimates

What am I doing wrong? I tried many different parameter values to no avail.
Thank you so much in advance,
Sincerely,

Eugene
McGill University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html