fitted-futures(schwartz97)
fitted-futures()所属R语言包:schwartz97
Extract Model Fitted Values
提取模型的拟合值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function to extract fitted values from schwartz2f.fit-objects.
提取拟合值schwartz2f.fit对象的功能。
用法----------Usage----------
## S4 method for signature 'schwartz2f.fit'
fitted(object, data, ttm)
参数----------Arguments----------
参数:object
A schwartz2f.fit-object returned from schwartz2f.fit.
返回schwartz2f.fitAschwartz2f.fit对象。
参数:data
A matrix with futures prices.
矩阵与期货价格。
参数:ttm
A matrix with the corresponding times to maturity (see Details).
矩阵与相应时间至到期日(见详情)。
Details
详细信息----------Details----------
The elements of data and ttm have the following interpretation: data[i,j] denotes the futures price whose time to maturity was ttm[i,j] when it was observed. The unit of ttm was defined by the argument deltat of fit.schwartz2f.
的元素data和ttm有如下解释:data[i,j]表示,期货价格的时间,到期日为ttm[i,j],当它被观察到。 ttm单位被定义的参数deltatfit.schwartz2f的。
值----------Value----------
A matrix containing the fitted values of the same dimension as data.
矩阵的拟合值的尺寸相同data。
(作者)----------Author(s)----------
Philipp Erb, David Luethi, Juri Hinz
参见----------See Also----------
fit.schwartz2f, schwartz2f.fit-class, resid.
fit.schwartz2f,schwartz2f.fit类resid。
实例----------Examples----------
data(futures)
## Estimate parameters for lumber data. Fit only 'mu', 'sigmaS',[#参数估计对木材的数据。只适合亩,Sigma的,]
## 'sigmaE', and 'rho' (and stop after 100 iterations).[#sigmaE,和rho沸石(及100次迭代后停止)。]
fit.obj <- fit.schwartz2f(futures$lumber$price, futures$lumber$ttm / 260,
opt.pars = c(s0 = FALSE, delta0 = FALSE, mu = TRUE,
sigmaS = TRUE, kappa = FALSE, alpha = FALSE,
sigmaE = TRUE, rho = TRUE, lambda = FALSE),
alpha = 0, kappa = 1.2, lambda = 0,
deltat = 1 / 260, control = list(maxit = 100))
fit.obj
## Get the fitted values[#得到的拟合值]
fitted.futures <- fitted(fit.obj, futures$lumber$price, futures$lumber$ttm / 260)
par(mfrow = c(1, 3))
## Plot futures prices[图期货价格]
plot(as.ts(futures$lumber$price), plot.type = "single", ylab = "Futures prices",
col = gray(seq(0.1, 0.9, length = 4)))
## Plot fitted values[#图的拟合值]
plot(as.ts(fitted.futures), plot.type = "single", ylab = "Fitted values",
col = gray(seq(0.1, 0.9, length = 4)))
## Plot relative difference[#图相对差]
plot(as.ts((fitted.futures - futures$lumber$price) / fitted.futures), plot.type = "single",
ylab = "Relative difference", col = gray(seq(0.1, 0.9, length = 4)))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|