estimating non-linear state space models

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

estimating non-linear state space models

Andreas-93
Hello,

 

I am trying to estimate the dynamic model for equity fund's alphas and betas described here: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740 <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The nonlinear state space model is described by equations (6) and (11). (For those in a hurry: The one dimensional state follows an AR1 process. The observation equation has similarities with CAPM, but is extended to depend quadratically on the state)

 

So far I have tried to work with the packages sspir and dse, but they don't seem to support non-linear models. I then tried to implement my own EKF code, it works for state estimation but so far I couldn't get the parameter and variance estimation running reliably.

 

Are there any R packages capable of joint or dual EKF for non-linear models?

 

I also had a look at ReBEL for MATLAB. I had some good results with the joint EKF for state and parameter estimation, but I can't see how to estimate both process and observations noise as well. So if there is any ReBEL specialist among you R experts, I would appreciate any help here as well.

 

Thank you and regards,

Andreas


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

estimating non-linear state space models

Andreas-93
Hello,

 

I am trying to estimate the dynamic model for equity fund's alphas and betas described here: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740 <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The nonlinear state space model is described by equations (6) and (11). (For those in a hurry: The one dimensional state follows an AR1 process. The observation equation has similarities with CAPM, but is extended to depend quadratically on the state)

 

So far I have tried to work with the packages sspir and dse, but they don't seem to support non-linear models. I then tried to implement my own EKF code, it works for state estimation but so far I couldn't get the parameter and variance estimation running reliably.

 

Are there any R packages capable of joint or dual EKF for non-linear models?

 

I also had a look at ReBEL for MATLAB. I had some good results with the joint EKF for state and parameter estimation, but I can't see how to estimate both process and observations noise as well. So if there is any ReBEL specialist among you R experts, I would appreciate any help here as well.

 

Thank you and regards,

Andreas


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

Re: estimating non-linear state space models

braverock
Andreas wrote:
> I am trying to estimate the dynamic model for equity fund's alphas and betas described here: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740 <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The nonlinear state space model is described by equations (6) and (11). (For those in a hurry: The one dimensional state follows an AR1 process. The observation equation has similarities with CAPM, but is extended to depend quadratically on the state)
>
> So far I have tried to work with the packages sspir and dse, but they don't seem to support non-linear models. I then tried to implement my own EKF code, it works for state estimation but so far I couldn't get the parameter and variance estimation running reliably.

You might try posting your code here, and being very specific about what
help you need.  That way everyone can benefit from an implementation of
these models in R.

Regards,

   - Brian

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

Re: estimating non-linear state space models

rbali
Just for those interested. The final version of that paper was published in
Review of Financial Studies 2008 21(1):233-264; doi:10.1093/rfs/hhm049.
Regards

Robert Iquiapaza
[hidden email]

--------------------------------------------------
From: "Brian G. Peterson" <[hidden email]>
Sent: Wednesday, July 23, 2008 10:03 AM
To: "r_sig_finance" <[hidden email]>
Cc: <[hidden email]>
Subject: Re: [R-SIG-Finance] estimating non-linear state space models

> Andreas wrote:
>> I am trying to estimate the dynamic model for equity fund's alphas and
>> betas described here:
>> http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740 
>> <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The
>> nonlinear state space model is described by equations (6) and (11). (For
>> those in a hurry: The one dimensional state follows an AR1 process. The
>> observation equation has similarities with CAPM, but is extended to
>> depend quadratically on the state)
>>
>> So far I have tried to work with the packages sspir and dse, but they
>> don't seem to support non-linear models. I then tried to implement my own
>> EKF code, it works for state estimation but so far I couldn't get the
>> parameter and variance estimation running reliably.
>
> You might try posting your code here, and being very specific about what
> help you need.  That way everyone can benefit from an implementation of
> these models in R.
>
> Regards,
>
>   - Brian
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

estimating non-linear state space models

Andreas-93
Re: [R-SIG-Finance] estimating non-linear state space models

I had to clean up my EKF code first, after trying many different ideas I ended up with a huge mess... It's still heavily under development, but I think it could serve as a starting point.

 

As I wrote before, state estimation seems to run OK given the true parameters.

 

When I try to estimate the parameters by maximizing the likelihood, I end up with rather random results depending on the initial parameters I start optimizing with.

 

I don’t know if there’s an error in the calculation of the likelihood, or if I’m just overstraining the ML-method by estimating model parameters and noise variances at the same time. Is this even possible? Or maybe I’m just expecting too precise results…

 

Regards

Andreas

 

 



Von: Robert Iquiapaza [mailto:[hidden email]]
Gesendet: Do 24.07.2008 03:21
An: Andreas
Cc: [hidden email]
Betreff: Re: [R-SIG-Finance] estimating non-linear state space models

Just for those interested. The final version of that paper was published in
Review of Financial Studies 2008 21(1):233-264; doi:10.1093/rfs/hhm049.
Regards

Robert Iquiapaza
[hidden email]

--------------------------------------------------
From: "Brian G. Peterson" <[hidden email]>
Sent: Wednesday, July 23, 2008 10:03 AM
To: "r_sig_finance" <[hidden email]>
Cc: <[hidden email]>
Subject: Re: [R-SIG-Finance] estimating non-linear state space models


> Andreas wrote:
>> I am trying to estimate the dynamic model for equity fund's alphas and
>> betas described here:
>> http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740
>> <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The
>> nonlinear state space model is described by equations (6) and (11). (For
>> those in a hurry: The one dimensional state follows an AR1 process. The
>> observation equation has similarities with CAPM, but is extended to
>> depend quadratically on the state)
>>
>> So far I have tried to work with the packages sspir and dse, but they
>> don't seem to support non-linear models. I then tried to implement my own
>> EKF code, it works for state estimation but so far I couldn't get the
>> parameter and variance estimation running reliably.
>
> You might try posting your code here, and being very specific about what
> help you need.  That way everyone can benefit from an implementation of
> these models in R.
>
> Regards,
>
>   - Brian
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>


_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

estimating non-linear state space models

Andreas-93
PS: The ML-calculation in the EFK-function shoud be:
 
return(sum(log(Inno)) + sum(Kerror^2/Inno))
 
instead of Perror, I missed that line while renaming in the version I attached earlier.
 

________________________________

Von: [hidden email] im Auftrag von Andreas
Gesendet: Do 24.07.2008 11:46
An: [hidden email]
Betreff: [R-SIG-Finance] estimating non-linear state space models


I had to clean up my EKF code first, after trying many different ideas I ended up with a huge mess... It's still heavily under development, but I think it could serve as a starting point.



As I wrote before, state estimation seems to run OK given the true parameters.



When I try to estimate the parameters by maximizing the likelihood, I end up with rather random results depending on the initial parameters I start optimizing with.



I don't know if there's an error in the calculation of the likelihood, or if I'm just overstraining the ML-method by estimating model parameters and noise variances at the same time. Is this even possible? Or maybe I'm just expecting too precise results...



Regards

Andreas






________________________________

Von: Robert Iquiapaza [mailto:[hidden email]]
Gesendet: Do 24.07.2008 03:21
An: Andreas
Cc: [hidden email]
Betreff: Re: [R-SIG-Finance] estimating non-linear state space models



Just for those interested. The final version of that paper was published in
Review of Financial Studies 2008 21(1):233-264; doi:10.1093/rfs/hhm049.
Regards

Robert Iquiapaza
[hidden email]

--------------------------------------------------
From: "Brian G. Peterson" <[hidden email]>
Sent: Wednesday, July 23, 2008 10:03 AM
To: "r_sig_finance" <[hidden email]>
Cc: <[hidden email]>
Subject: Re: [R-SIG-Finance] estimating non-linear state space models

> Andreas wrote:
>> I am trying to estimate the dynamic model for equity fund's alphas and
>> betas described here:
>> http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740
>> <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The
>> nonlinear state space model is described by equations (6) and (11). (For
>> those in a hurry: The one dimensional state follows an AR1 process. The
>> observation equation has similarities with CAPM, but is extended to
>> depend quadratically on the state)
>>
>> So far I have tried to work with the packages sspir and dse, but they
>> don't seem to support non-linear models. I then tried to implement my own
>> EKF code, it works for state estimation but so far I couldn't get the
>> parameter and variance estimation running reliably.
>
> You might try posting your code here, and being very specific about what
> help you need.  That way everyone can benefit from an implementation of
> these models in R.
>
> Regards,
>
>   - Brian
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.
Reply | Threaded
Open this post in threaded view
|

Re: estimating non-linear state space models

Spencer Graves
      Have you looked at the 'dlm' package for "Bayesian and Likelihood
Analysis of Dynamic Linear Models"?  It has optional parameters 'JFF',
'JV', 'JGG', 'JW', and 'X' to support nonlinear modifications of the
standard Kalman terms 'm0', 'C0', 'FF', 'V', 'GG', 'W'.  Moreover, it
has a vignette that helps learning its capabilities.  This should
support your needs provided the (standardized) residuals can plausibly
be assumed to be normally distributed.

      Hope this helps.
      Spencer

Andreas wrote:

> PS: The ML-calculation in the EFK-function shoud be:
>  
> return(sum(log(Inno)) + sum(Kerror^2/Inno))
>  
> instead of Perror, I missed that line while renaming in the version I attached earlier.
>  
>
> ________________________________
>
> Von: [hidden email] im Auftrag von Andreas
> Gesendet: Do 24.07.2008 11:46
> An: [hidden email]
> Betreff: [R-SIG-Finance] estimating non-linear state space models
>
>
> I had to clean up my EKF code first, after trying many different ideas I ended up with a huge mess... It's still heavily under development, but I think it could serve as a starting point.
>
>
>
> As I wrote before, state estimation seems to run OK given the true parameters.
>
>
>
> When I try to estimate the parameters by maximizing the likelihood, I end up with rather random results depending on the initial parameters I start optimizing with.
>
>
>
> I don't know if there's an error in the calculation of the likelihood, or if I'm just overstraining the ML-method by estimating model parameters and noise variances at the same time. Is this even possible? Or maybe I'm just expecting too precise results...
>
>
>
> Regards
>
> Andreas
>
>
>
>
>
>
> ________________________________
>
> Von: Robert Iquiapaza [mailto:[hidden email]]
> Gesendet: Do 24.07.2008 03:21
> An: Andreas
> Cc: [hidden email]
> Betreff: Re: [R-SIG-Finance] estimating non-linear state space models
>
>
>
> Just for those interested. The final version of that paper was published in
> Review of Financial Studies 2008 21(1):233-264; doi:10.1093/rfs/hhm049.
> Regards
>
> Robert Iquiapaza
> [hidden email]
>
> --------------------------------------------------
> From: "Brian G. Peterson" <[hidden email]>
> Sent: Wednesday, July 23, 2008 10:03 AM
> To: "r_sig_finance" <[hidden email]>
> Cc: <[hidden email]>
> Subject: Re: [R-SIG-Finance] estimating non-linear state space models
>
>  
>> Andreas wrote:
>>    
>>> I am trying to estimate the dynamic model for equity fund's alphas and
>>> betas described here:
>>> http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740
>>> <http://papers.ssrn.com/sol3/papers.cfm?abstract_id=389740>  . The
>>> nonlinear state space model is described by equations (6) and (11). (For
>>> those in a hurry: The one dimensional state follows an AR1 process. The
>>> observation equation has similarities with CAPM, but is extended to
>>> depend quadratically on the state)
>>>
>>> So far I have tried to work with the packages sspir and dse, but they
>>> don't seem to support non-linear models. I then tried to implement my own
>>> EKF code, it works for state estimation but so far I couldn't get the
>>> parameter and variance estimation running reliably.
>>>      
>> You might try posting your code here, and being very specific about what
>> help you need.  That way everyone can benefit from an implementation of
>> these models in R.
>>
>> Regards,
>>
>>   - Brian
>>
>> _______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>>
>>    
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.