[Pomp-commits] r925 - branches pkg pkg/mif2/man pkg/mif2/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 17 19:12:34 CEST 2014
Author: kingaa
Date: 2014-04-17 19:12:34 +0200 (Thu, 17 Apr 2014)
New Revision: 925
Added:
pkg/mif2/
Removed:
branches/mif2/
Modified:
pkg/mif2/man/mif2.Rd
pkg/mif2/tests/ou2-mif2.R
pkg/mif2/tests/ou2-mif2.Rout.save
Log:
- move 'mif2' to 'pkg' directory
Modified: pkg/mif2/man/mif2.Rd
===================================================================
--- branches/mif2/man/mif2.Rd 2014-04-17 16:48:19 UTC (rev 924)
+++ pkg/mif2/man/mif2.Rd 2014-04-17 17:12:34 UTC (rev 925)
@@ -43,6 +43,9 @@
and so on, while when \code{T=length(time(object,t0=TRUE))},
\code{Np(T)} is the number of particles to sample at the end of the time-series.
}
+ \item{perturb.fn}{
+ \code(perturb.fn(params,mifiter,timeno,\dots))
+ }
\item{tol}{
See the description under \code{\link{pfilter}}.
}
@@ -60,14 +63,6 @@
additional arguments that override the defaults.
}
}
-\section{Re-running MIF Iterations}{
-}
-\section{Continuing MIF Iterations}{
-}
-\section{Using MIF to estimate initial-value parameters only}{
-}
-\section{Details}{
-}
\references{
E. L. Ionides, A. Bhadra, Y. Atchad{\\'e}, & A. A. King,
Iterated filtering,
Modified: pkg/mif2/tests/ou2-mif2.R
===================================================================
--- branches/mif2/tests/ou2-mif2.R 2014-04-17 16:48:19 UTC (rev 924)
+++ pkg/mif2/tests/ou2-mif2.R 2014-04-17 17:12:34 UTC (rev 925)
@@ -47,8 +47,12 @@
compare.mif(list(mif1a,mif2a))
set.seed(64857673L)
-mif1b <- mif(ou2,Nmif=50,start=guess1,
- pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+mif1b <- mif(
+ ou2,
+ Nmif=50,
+ start=guess1,
+ pars=c('alpha.2','alpha.3'),
+ ivps=c('x1.0','x2.0'),
rw.sd=c(
x1.0=0.5,x2.0=0.5,
alpha.2=0.1,alpha.3=0.1),
@@ -62,8 +66,12 @@
)
mif1b <- continue(mif1b,Nmif=50)
-mif2b <- mif(ou2,Nmif=50,start=guess1,
- pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+mif2b <- mif(
+ ou2,
+ Nmif=50,
+ start=guess1,
+ pars=c('alpha.2','alpha.3'),
+ ivps=c('x1.0','x2.0'),
rw.sd=c(
x1.0=0.5,x2.0=0.5,
alpha.2=0.1,alpha.3=0.1),
@@ -79,8 +87,12 @@
)
mif2b <- continue(mif2b,Nmif=50)
-mif2c <- mif(ou2,Nmif=50,start=guess1,
- pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+mif2c <- mif(
+ ou2,
+ Nmif=50,
+ start=guess1,
+ pars=c('alpha.2','alpha.3'),
+ ivps=c('x1.0','x2.0'),
rw.sd=c(
x1.0=0.5,x2.0=0.5,
alpha.2=0.1,alpha.3=0.1),
@@ -95,10 +107,8 @@
mif2c <- continue(mif2c,Nmif=50)
compare.mif(list(mif1b,mif2b))
-
compare.mif(list(mif1a,mif1b))
compare.mif(list(mif2a,mif2b))
-
compare.mif(list(mif1b,mif2c))
mif3a <- mif2(
@@ -131,6 +141,4 @@
Np=1000
)
-
-
dev.off()
Modified: pkg/mif2/tests/ou2-mif2.Rout.save
===================================================================
--- branches/mif2/tests/ou2-mif2.Rout.save 2014-04-17 16:48:19 UTC (rev 924)
+++ pkg/mif2/tests/ou2-mif2.Rout.save 2014-04-17 17:12:34 UTC (rev 925)
@@ -1,5 +1,5 @@
-R version 3.0.3 (2014-03-06) -- "Warm Puppy"
+R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -16,6 +16,7 @@
Type 'q()' to quit R.
> library(mif2)
+Loading required package: pomp
Loading required package: mvtnorm
Loading required package: subplex
Loading required package: nloptr
@@ -33,10 +34,13 @@
> guess2[c('x1.0','x2.0','alpha.2','alpha.3')] <- 1.2*guess1[c('x1.0','x2.0','alpha.2','alpha.3')]
>
> set.seed(64857673L)
-> mif1a <- mif(ou2,Nmif=100,start=guess1,
+> mif1a <- mif(
++ ou2,
++ Nmif=100,
++ start=guess1,
+ pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+ rw.sd=c(
-+ x1.0=.5,x2.0=.5,
++ x1.0=0.5,x2.0=0.5,
+ alpha.2=0.1,alpha.3=0.1),
+ transform=F,
+ Np=1000,
@@ -51,7 +55,7 @@
> mif2a <- mif(ou2,Nmif=100,start=guess1,
+ pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+ rw.sd=c(
-+ x1.0=0.5,x2.0=.5,
++ x1.0=0.5,x2.0=0.5,
+ alpha.2=0.1,alpha.3=0.1),
+ transform=F,
+ Np=1000,
@@ -67,10 +71,14 @@
> compare.mif(list(mif1a,mif2a))
>
> set.seed(64857673L)
-> mif1b <- mif(ou2,Nmif=50,start=guess1,
-+ pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+> mif1b <- mif(
++ ou2,
++ Nmif=50,
++ start=guess1,
++ pars=c('alpha.2','alpha.3'),
++ ivps=c('x1.0','x2.0'),
+ rw.sd=c(
-+ x1.0=.5,x2.0=.5,
++ x1.0=0.5,x2.0=0.5,
+ alpha.2=0.1,alpha.3=0.1),
+ transform=F,
+ Np=1000,
@@ -82,10 +90,14 @@
+ )
> mif1b <- continue(mif1b,Nmif=50)
>
-> mif2b <- mif(ou2,Nmif=50,start=guess1,
-+ pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+> mif2b <- mif(
++ ou2,
++ Nmif=50,
++ start=guess1,
++ pars=c('alpha.2','alpha.3'),
++ ivps=c('x1.0','x2.0'),
+ rw.sd=c(
-+ x1.0=0.5,x2.0=.5,
++ x1.0=0.5,x2.0=0.5,
+ alpha.2=0.1,alpha.3=0.1),
+ transform=F,
+ Np=1000,
@@ -102,10 +114,14 @@
See '?mif' for instructions on specifying the cooling schedule.
> mif2b <- continue(mif2b,Nmif=50)
>
-> mif2c <- mif(ou2,Nmif=50,start=guess1,
-+ pars=c('alpha.2','alpha.3'),ivps=c('x1.0','x2.0'),
+> mif2c <- mif(
++ ou2,
++ Nmif=50,
++ start=guess1,
++ pars=c('alpha.2','alpha.3'),
++ ivps=c('x1.0','x2.0'),
+ rw.sd=c(
-+ x1.0=0.5,x2.0=.5,
++ x1.0=0.5,x2.0=0.5,
+ alpha.2=0.1,alpha.3=0.1),
+ transform=F,
+ Np=1000,
@@ -118,16 +134,44 @@
> mif2c <- continue(mif2c,Nmif=50)
>
> compare.mif(list(mif1b,mif2b))
->
> compare.mif(list(mif1a,mif1b))
> compare.mif(list(mif2a,mif2b))
->
> compare.mif(list(mif1b,mif2c))
>
+> mif3a <- mif2(
++ ou2,
++ Nmif=50,
++ start=guess1,
++ perturb.fn=function(params,mifiter,timeno,...){
++ pert <- params
++ ic.sd <- c(x1.0=0.5,x2.0=0.5)
++ par.sd <- c(alpha.2=0.1,alpha.3=0.1)
++ frac <- 0.05
++ nT <- length(time(ou2))
++ theta <- (1-frac)/frac/(50*nT-1)
++ sigma <- 1/(1+theta*((mifiter-1)*nT+timeno-1))
++ if (timeno==1) {
++ pert[names(ic.sd)] <- rnorm(
++ n=length(ic.sd),
++ mean=pert[names(ic.sd)],
++ sd=ic.sd*sigma
++ )
++ }
++ pert[names(par.sd)] <- rnorm(
++ n=length(par.sd),
++ mean=pert[names(par.sd)],
++ sd=par.sd*sigma
++ )
++ pert
++ },
++ transform=FALSE,
++ Np=1000
++ )
+>
> dev.off()
null device
1
>
> proc.time()
user system elapsed
- 50.335 0.068 50.772
+273.761 0.368 275.385
More information about the pomp-commits
mailing list