Closed chy06 closed 7 years ago
It is all in the code:
> nbeta
function (p, d, m)
{
nbetaMT(c(p, 0), d, m)
}
> nbetaMT
function (p, d, m)
{
eps <- .Machine$double.eps
xi <- (1:d - 1)/(d - 1)
xi[1] <- xi[1] + eps
xi[d] <- xi[d] - eps
nb <- xi^(p[2] - 1) * (1 - xi)^(p[3] - 1)
if (sum(nb) < eps) {
if (abs(p[4]) < eps)
rep(0, d)
else p[1] * rep(1/d, length(nb))
}
else {
w <- (nb/sum(nb) + p[4])
p[1] * w/sum(w)
}
}
Function nbeta
calls nbetaMT
, which was taken from MATLAB MIDAS toolbox. The difference from the usual normalized beta is that additional constant is added after normalization. This constant is passed as a fourth element of the parameter vector. If it is zero then nbetaMT
and nbeta
give the same result. All the other elements of the parameter vector are ignored.
I see, thank you!
Hi - I have a similar question. What is the fourth parameter achieving? I understand that we have a normalising constant and two hyperparamters - but I can't see the purpose of the fourth parameter?
When I was developing the midasr package, I tried to make it compatible with MIDAS toolbox for Matlab. The Matlab toolbox had the fourth parameter. As you can see from the code it acts as a sort of bias, i.e it shifts the coefficients.
Hi. I've read the closed issue about fact that nbeta has 3 parameters. But as I tried for example, nbeta(c(0.3,0.1,0.2,0.4),2), or using midas_r with a starting value of length 4 or more, it still gives me something. I wonder what it means.