from an example of the doc of fMultivar
This is the script with the "require" for the libraries
and under R2.3.1
Copy of the error message
is it necesary to load an other lib ? an other function ?
Thanks
sincerely
Michel POUCHAIN
university PAris 13
------------------------------------------------------------
require(fBasics)
require(fCalendar)
require(fSeries)
require(fMultivar)
require(fExtremes)
require(fOptions)
require(fPortfolio)
require(mgcv)
## SOURCE("fMultivar.2A-RegressionModelling")
## Not run:
## regFit -
data(recession)
recession[,1] = paste(recession[,1], "28", sep = "")
## myPlot -
myPlot = function(recession, in.sample) {
recession = as.timeSeries(recession)[, "recession"]
in.sample = as.timeSeries(recession)[, "recession"]
Date = recession[, "date"]
Date = trunc(Date/100) + (Date-100*trunc(Date/100))/12
Recession = recession[, "recession"]
inSample = as.vector(in.sample)
plot(Date, Recession, type = "n", main = "US Recession")
grid()
lines(Date, Recession, type = "h", col = "steelblue3")
lines(Date, inSample)
}
## Generalized Additive Modelling:
require(mgcv)
par(mfrow = c(2, 2))
fit = gregFit(formula = recession ~ s(tbills3m) + s(tbonds10y),
family = gaussian(), data = recession, use = "gam")
# In Sample Prediction:
in.sample = predict(fit, newdata = recession)$fit
myPlot(recession, in.sample)
# Summary:
summary(fit)
# Add plots from the original plot method:
gam.fit = fit at fit
class(gam.fit) = "gam"
plot(gam.fit)
## End(Not run)
------------------------------------
Error message
-------------
[1] TRUE
par(mfrow = c(2, 2))
fit = gregFit(formula = recession ~ s(tbills3m) + s(tbonds10y),
+ family = gaussian(), data = recession, use = "gam")
Erreur : impossible de trouver la fonction "gregFit"
# In Sample Prediction:
in.sample = predict(fit, newdata = recession)$fit
Erreur dans predict(fit, newdata = recession) :
objet "fit" non trouv?
myPlot(recession, in.sample)
Erreur dans if (timeTest == 0) iso.format = "%Y-%m-%d" :
valeur manquante l? o? TRUE / FALSE est requis
Erreur dans summary(fit) : objet "fit" non trouv?
# Add plots from the original plot method:
gam.fit = fit at fit
Erreur : objet "fit" non trouv?
class(gam.fit) = "gam"
plot(gam.fit)
Erreur dans plot.gam(gam.fit) : No terms to plot - nothing for
plot.gam() to do.
------------------------------
Message: 2
Date: Tue, 9 Jan 2007 17:26:48 -0800 (PST)
From: Tobias <tobias_elbert at hotmail.com>
Subject: [R-SIG-Finance] Backing out implied parameters from HNGARCH
option model
To: r-sig-finance at stat.math.ethz.ch
Message-ID: <8250644.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Dear all,
I am trying to back out the implied parameters using observed options prices
and the Heston-Nandi Garch model via NLS.
For this purpose I am using Diethelm Wuertz's pricing algorithm in a
function called hnoption similar to this:
hnoption <- function(b) #where b is the vector of parameters passed on
to the pricing algorithm
{
....
hnoption <- value obtained via pricing algorithm
}
calccall <- function(b)
{
for (jj in 1:num1)
{
counter <<- jj
qq[jj] <- hnoption(b)
}
calccall <- sum((c-qq)^2)
}
# some initial guess of parameters
bstart <- c(.1,.1,1,-.5,.7)
p <- optim(bstart,calccall,hessian = TRUE)
The code works fine for a few iterations of optim(). However, at some point
it produces parameter values that cause an integral that's being evaluated
in hnoption to drift off to infinity. At least that's what I think happens
when R produces the error: error in integrate(): non-finite function value.
I have tried to constrain some parameters in optim() but keep receiving the
same error.
I would really appreciate if someone could point me to possible solutions.
Regards
Tobias
--
View this message in context: http://www.nabble.com/Backing-out-implied-parameters-from-HNGARCH-option-model-tf2950123.html#a8250644
Sent from the Rmetrics mailing list archive at Nabble.com.
------------------------------