[R-SIG-Finance] a pb wtith a script of fMultivar
POUCHAIN Michel
michel.pouchain at certi.adc.education.fr
Fri Jan 19 08:42:16 CET 2007
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
> # Summary:
> summary(fit)
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.
> ## End(Not run)
>
>
More information about the R-SIG-Finance
mailing list