[Yuima-commits] r183 - pkg/yuimadocs/inst/doc/JSS
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 13 04:03:59 CEST 2011
Author: iacus
Date: 2011-09-13 04:03:54 +0200 (Tue, 13 Sep 2011)
New Revision: 183
Modified:
pkg/yuimadocs/inst/doc/JSS/article.Rnw
Log:
update
Modified: pkg/yuimadocs/inst/doc/JSS/article.Rnw
===================================================================
--- pkg/yuimadocs/inst/doc/JSS/article.Rnw 2011-09-09 08:02:33 UTC (rev 182)
+++ pkg/yuimadocs/inst/doc/JSS/article.Rnw 2011-09-13 02:03:54 UTC (rev 183)
@@ -11,10 +11,13 @@
%% almost as usual
\author{Alexandre Brouste\\University of Le Mans \And
- Stefano M. Iacus\\University of Milan \And
- Hiroki Masuda\\University of Kyushu \And
- Masaaki Fukasawa\\University of ???\AND
+ Masaaki Fukasawa\\University of Osaka\And
+ Hideitsu Hino\\Waseda University\And
+ Stefano M. Iacus\\University of Milan \AND
Kengo Kamatani\\University of Tokyo \And
+ Koike Yuta\\University of Tokyo\And
+ Hiroki Masuda\\University of Kyushu \AND
+ Ryosuke Nomura\\University of Tokyo\And
Yusutaka Shimuzu\\University of Osaka \And
Masayuki Uchida\\University of Osaka \And
Nakahiro Yoshida\\University of Tokyo
@@ -531,28 +534,27 @@
$$\tilde\theta_n=\arg\min_\theta \ell_n({\bf X}_n,\theta)$$
As an example, we consider the simple model
\begin{equation}
-\de X_t = -\theta_2 X_t \de t + \theta_1 \de W_t
+\de X_t = (2-\theta_2 X_t) \de t + (1+X_t^2)^{\theta_1} \de W_t
\label{eq:model1}
\end{equation}
-with $\theta_1=0.3$ and $\theta_2=0.1$
+with $\theta_1=0.3$ and $\theta_2=0.2$
<<echo=TRUE, print=FALSE,results=hide>>=
-ymodel <- setModel(drift = "-x*theta2", diffusion = "theta1",
- time.variable = "t", state.variable = "x", solve.variable = "x")
-n <- 1000
-ysamp <- setSampling(Terminal = (n)^(1/3), n = n)
+ymodel <- setModel(drift="(2-theta2*x)", diffusion="(1+x^2)^theta1")
+n <- 500
+ysamp <- setSampling(Terminal = n^(1/3), n = n)
yuima <- setYuima(model = ymodel, sampling = ysamp)
set.seed(123)
-yuima <- simulate(yuima, xinit = 1, true.parameter = list(theta1 = 0.3, theta2 = 0.1))
+yuima <- simulate(yuima, xinit = 1, true.parameter = list(theta1 = 0.2, theta2 = 0.3))
@
With the simulated path we can use the function \code{qmle} to estimate the parameters as follows
<<echo=TRUE, print=FALSE,results=hide>>=
-mle1 <- qmle(yuima, start = list(theta1 = 0.8, theta2 = 0.7),
- lower = list(theta1=0.05, theta2=0.05),
- upper = list(theta1=0.5, theta2=0.5), method = "L-BFGS-B")
+param.init <- list(theta2=0.5,theta1=0.5)
+mle1 <- qmle(yuima, start =param.init ,
+ lower = list(theta1=0, theta2=0),
+ upper = list(theta1=1, theta2=1))
@
and the estimated coefficients are as follows
<<echo=TRUE, print=FALSE>>=
-coef(mle1)
summary(mle1)
@
Notice the interface and the output of the \code{qmle} is quite similar to the ones of the standard \code{mle} function of the \pkg{stats4} package of the base \proglang{R} system.
@@ -602,16 +604,15 @@
In order to perform Bayesian estimation, we need to prepare the prior densities for the parameters.
For simplicity we use uniform distributions in $[0,1]$
<<echo=TRUE>>=
-prior <- list(theta2=list(measure.type="code",df="dunif(z,0,1)"), theta1=list(measure.type="code",df="dunif(z,0,1)"))
+prior <- list(theta2=list(measure.type="code",df="dunif(theta2,0,1)"), theta1=list(measure.type="code",df="dunif(theta1,0,1)"))
@
Then we call $\tt adaBayes$ as follows
<<eval=TRUE,echo=TRUE, results=hide>>=
-param.init <- list(theta2=0.5,theta1=0.5)
bayes1 <- adaBayes(yuima, start=param.init, prior=prior, method="nomcmc")
@
and we can compare the adaptive Bayes estimates with the QMLE estimates
<<eval=TRUE,echo=TRUE>>=
-bayes1 at coef
+coef(bayes1)
coef(mle1)
@
The argument \code{method="nomcmc"} in \code{adaBayes} performs numerical integration, otherwise MCMC method is used.
More information about the Yuima-commits
mailing list