# Estimating a one-factor model using the DLM package

5 messages
Open this post in threaded view
|

## Estimating a one-factor model using the DLM package

 Hi, I am trying to estimate a one-factor model of the spread y(t) between two interest rates y(t) = a + b*s(t) + u(t) s(t) = c*s(t-1) + v(t) using the DLM package in R. Is it possible to estimate the parameters a, b, c, and var(u(t)). Var(v(t)) = 1. I have EViews code for that and I want to replicate it using R. Hannu         [[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. -- Also note that this is not the r-help list where general R questions should go.
Open this post in threaded view
|

## Re: Estimating a one-factor model using the DLM package

 Not sure what you want to do but dlmMLE function would estimate some parameters to start, and dlmFilter and dlmForecast would predict expected values. DLM would need some study . Documents in https://cran.r-project.org/package=dlm are a good start , also the book "Dynamic Linear Models with R",  ISBN 978-0-387-77237-0 e-ISBN 978-0-387-77238-7 -----Original Message----- From: "Hannu Kahra" [[hidden email]] Date: 02/05/2017 11:19 AM To: [hidden email] Subject: [R-SIG-Finance] Estimating a one-factor model using the DLM package Hi, I am trying to estimate a one-factor model of the spread y(t) between two interest rates y(t) = a + b*s(t) + u(t) s(t) = c*s(t-1) + v(t) using the DLM package in R. Is it possible to estimate the parameters a, b, c, and var(u(t)). Var(v(t)) = 1. I have EViews code for that and I want to replicate it using R. Hannu         [[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. -- Also note that this is not the r-help list where general R questions should go. _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance-- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Open this post in threaded view
|

## Re: Estimating a one-factor model using the DLM package

 I specify the problem more clearly. My model is y(t) = a + b*s(t) + u(t) s(t) = c*s(t-1) + v(t) that is a stochastic linear trend model in the DLM package obtained by setting dlmModPoly(order = 2). The parameters b and c are fixed to 1 by construction. In my problem I can allow b = 1, but I would like to estimate c in the state equation. In other applications, I want to estimate parameter b in the signal equation, as well. I have had a look at the MARSS package and it seems that b and c can be free parameters in estimation. Hannu On Tue, Feb 7, 2017 at 3:53 PM, ce <[hidden email]> wrote: > > Not sure what you want to do but dlmMLE function would estimate some > parameters to start, and dlmFilter and dlmForecast would predict expected > values. DLM would need some study . > Documents in https://cran.r-project.org/package=dlm are a good start , > also the book "Dynamic Linear Models with R",  ISBN 978-0-387-77237-0 > e-ISBN 978-0-387-77238-7 > > -----Original Message----- > From: "Hannu Kahra" [[hidden email]] > Date: 02/05/2017 11:19 AM > To: [hidden email] > Subject: [R-SIG-Finance] Estimating a one-factor model using the DLM > package > > Hi, > > I am trying to estimate a one-factor model of the spread y(t) between two > interest rates > > y(t) = a + b*s(t) + u(t) > s(t) = c*s(t-1) + v(t) > > using the DLM package in R. Is it possible to estimate the parameters a, b, > c, and var(u(t)). Var(v(t)) = 1. > > I have EViews code for that and I want to replicate it using R. > > Hannu > >         [[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. > -- Also note that this is not the r-help list where general R questions > should go. > > > >         [[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. -- Also note that this is not the r-help list where general R questions should go.