[R] R help
R. Michael Weylandt
michael.weylandt at gmail.com
Wed Nov 30 20:42:02 CET 2011
Just throwing this out there: there's no probability distribution in
the equation you gave, so there's no context for an MLE: what is the
likelihood for m?
Knowing a little bit about the NS model, it seems like it makes more
sense to use nls() to fit all four parameters to the data at once.
Something like this:
nls(y ~ a + b*(1-exp(-m/tau))/(m/tau)+c*((1-exp(-m/tau))/(m/tau)-exp(-m/tau)),
data = data.frame(y = y, tau = tau), start = list(a = 1, b = 1, c
= 1, m = 1))
Note that as presented, this doesn't work, but it's hopefully a good
start (I'm not very good with nls).
However, the smartest thing to do is to do your homework before
jumping into a project:
Nelson.Siegel(y, tau, c(48, 60, 84))
On Tue, Nov 29, 2011 at 1:13 PM, Heh Ness <imostfu at yahoo.com> wrote:
> I have a model like this (Nelson and Siegel 1987)
> <img src="http://r.789695.n4.nabble.com/file/n4120161/31f188c684764cd431619dbb59fed5ae.png" border="0"/>
> where tau and y are the maturities and yields, respectively, given to me in my data file..
> I firstly need to find the MLE of m which maximises the likelihood function and then I can easily find the b1, b2 and b3 constants using this m value via least squares estimation..
> But does anybody know how I can go abouts finding the MLE of m and if you could help with providing r code for it, I would appreciate that a lot. I have been pulling my hair out for the past week now trying to do it :)
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> 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