Description Usage Arguments Details Value Author(s) Examples
Function for Newton-Raphson method for xi
1 | NewtRaphXi(xiseed, theta, Y, X, tol = 10^(-5))
|
xiseed |
Initial value |
theta |
theta |
Y |
data |
X |
data |
tol |
approximation tolerance |
Okay
list
E. A. Pena
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (xiseed, theta, Y, X, tol = 10^(-5))
{
rho = exp(X %*% theta)
n = length(Y)
kiter = 0
OK = FALSE
xi0 = xiseed
while (!OK) {
kiter = kiter + 1
g = sum((Y - rho)^2 - rho * (1 + (1 + rho)/xi0))
gp = sum(rho * (1 + rho))/xi0^2
xi1 = xi0 - g/gp
if (abs(xi1 - xi0) < tol) {
OK = TRUE
}
xi0 = xi1
if (xi1 < 0) {
OK = FALSE
xiseed = xiseed/2
xi0 = xiseed
kiter = 0
}
}
return(list(kiter = kiter, xi = xi1))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.