[Pomp-commits] r819 - in pkg/pomp: inst/examples tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 16 12:51:11 CET 2013


Author: kingaa
Date: 2013-01-16 12:51:10 +0100 (Wed, 16 Jan 2013)
New Revision: 819

Modified:
   pkg/pomp/inst/examples/euler.sir.R
   pkg/pomp/inst/examples/gillespie.sir.R
   pkg/pomp/inst/examples/gompertz.R
   pkg/pomp/inst/examples/ou2.R
   pkg/pomp/inst/examples/ricker.R
   pkg/pomp/inst/examples/rw2.R
   pkg/pomp/inst/examples/verhulst.R
   pkg/pomp/tests/filtfail.Rout.save
   pkg/pomp/tests/gompertz.Rout.save
   pkg/pomp/tests/ou2-mif.Rout.save
   pkg/pomp/tests/skeleton.R
   pkg/pomp/tests/skeleton.Rout.save
   pkg/pomp/tests/verhulst.Rout.save
Log:
- the 'pompExample' examples no longer simulate data at run time
- update the tests


Modified: pkg/pomp/inst/examples/euler.sir.R
===================================================================
--- pkg/pomp/inst/examples/euler.sir.R	2013-01-16 11:50:16 UTC (rev 818)
+++ pkg/pomp/inst/examples/euler.sir.R	2013-01-16 11:51:10 UTC (rev 819)
@@ -1,12 +1,229 @@
 require(pomp)
 
+dat <- '"time";"reports"
+0,0192307692307692;617
+0,0384615384615385;638
+0,0576923076923077;603
+0,0769230769230769;655
+0,0961538461538462;585
+0,115384615384615;677
+0,134615384615385;686
+0,153846153846154;674
+0,173076923076923;710
+0,192307692307692;798
+0,211538461538462;803
+0,230769230769231;795
+0,25;892
+0,269230769230769;925
+0,288461538461538;1000
+0,307692307692308;1002
+0,326923076923077;1088
+0,346153846153846;1012
+0,365384615384615;1043
+0,384615384615385;1095
+0,403846153846154;998
+0,423076923076923;1045
+0,442307692307692;1034
+0,461538461538462;904
+0,480769230769231;938
+0,5;854
+0,519230769230769;831
+0,538461538461539;734
+0,557692307692308;678
+0,576923076923077;715
+0,596153846153846;593
+0,615384615384615;581
+0,634615384615385;549
+0,653846153846154;509
+0,673076923076923;419
+0,692307692307692;389
+0,711538461538462;323
+0,730769230769231;305
+0,75;258
+0,769230769230769;255
+0,788461538461539;233
+0,807692307692308;208
+0,826923076923077;197
+0,846153846153846;168
+0,865384615384616;171
+0,884615384615385;160
+0,903846153846154;138
+0,923076923076923;138
+0,942307692307692;134
+0,961538461538462;100
+0,980769230769231;110
+1;126
+1,01923076923077;120
+1,03846153846154;115
+1,05769230769231;125
+1,07692307692308;109
+1,09615384615385;98
+1,11538461538462;112
+1,13461538461538;136
+1,15384615384615;123
+1,17307692307692;123
+1,19230769230769;113
+1,21153846153846;155
+1,23076923076923;132
+1,25;158
+1,26923076923077;139
+1,28846153846154;139
+1,30769230769231;161
+1,32692307692308;171
+1,34615384615385;156
+1,36538461538462;199
+1,38461538461538;183
+1,40384615384615;221
+1,42307692307692;200
+1,44230769230769;221
+1,46153846153846;227
+1,48076923076923;200
+1,5;233
+1,51923076923077;221
+1,53846153846154;225
+1,55769230769231;228
+1,57692307692308;223
+1,59615384615385;215
+1,61538461538462;233
+1,63461538461538;227
+1,65384615384615;220
+1,67307692307692;208
+1,69230769230769;199
+1,71153846153846;243
+1,73076923076923;182
+1,75;197
+1,76923076923077;183
+1,78846153846154;176
+1,80769230769231;191
+1,82692307692308;173
+1,84615384615385;172
+1,86538461538462;171
+1,88461538461538;224
+1,90384615384615;196
+1,92307692307692;212
+1,94230769230769;210
+1,96153846153846;204
+1,98076923076923;189
+2;224
+2,01923076923077;216
+2,03846153846154;198
+2,05769230769231;261
+2,07692307692308;267
+2,09615384615385;292
+2,11538461538462;284
+2,13461538461538;311
+2,15384615384615;368
+2,17307692307692;374
+2,19230769230769;473
+2,21153846153846;482
+2,23076923076923;506
+2,25;626
+2,26923076923077;644
+2,28846153846154;675
+2,30769230769231;826
+2,32692307692308;917
+2,34615384615385;1014
+2,36538461538462;1083
+2,38461538461538;1174
+2,40384615384615;1265
+2,42307692307692;1244
+2,44230769230769;1390
+2,46153846153846;1468
+2,48076923076923;1507
+2,5;1468
+2,51923076923077;1455
+2,53846153846154;1470
+2,55769230769231;1333
+2,57692307692308;1294
+2,59615384615385;1207
+2,61538461538462;1126
+2,63461538461538;1025
+2,65384615384615;979
+2,67307692307692;942
+2,69230769230769;828
+2,71153846153846;738
+2,73076923076923;707
+2,75;594
+2,76923076923077;532
+2,78846153846154;525
+2,80769230769231;493
+2,82692307692308;452
+2,84615384615385;424
+2,86538461538462;369
+2,88461538461538;355
+2,90384615384615;330
+2,92307692307692;336
+2,94230769230769;270
+2,96153846153846;254
+2,98076923076923;250
+3;238
+3,01923076923077;230
+3,03846153846154;238
+3,05769230769231;241
+3,07692307692308;242
+3,09615384615385;249
+3,11538461538462;218
+3,13461538461538;240
+3,15384615384615;266
+3,17307692307692;237
+3,19230769230769;233
+3,21153846153846;213
+3,23076923076923;224
+3,25;244
+3,26923076923077;249
+3,28846153846154;280
+3,30769230769231;262
+3,32692307692308;292
+3,34615384615385;282
+3,36538461538462;281
+3,38461538461538;298
+3,40384615384615;280
+3,42307692307692;343
+3,44230769230769;296
+3,46153846153846;281
+3,48076923076923;297
+3,5;323
+3,51923076923077;287
+3,53846153846154;276
+3,55769230769231;259
+3,57692307692308;238
+3,59615384615385;259
+3,61538461538462;273
+3,63461538461538;206
+3,65384615384615;240
+3,67307692307692;219
+3,69230769230769;227
+3,71153846153846;206
+3,73076923076923;196
+3,75;191
+3,76923076923077;180
+3,78846153846154;166
+3,80769230769231;165
+3,82692307692308;180
+3,84615384615385;157
+3,86538461538462;152
+3,88461538461538;154
+3,90384615384615;150
+3,92307692307692;157
+3,94230769230769;147
+3,96153846153846;152
+3,98076923076923;149
+4;168
+'
+
+
 po <- pomp(
-           data=data.frame(
-             time=seq(from=1/52,to=4,by=1/52),
-             reports=NA
-             ),
+           data=read.csv2(textConnection(dat)),
            times="time",
            t0=0,
+           params=c(
+             gamma=26,mu=0.02,iota=0.01,
+             beta1=400,beta2=480,beta3=320,
+             beta.sd=1e-3,
+             pop=2.1e6,
+             rho=0.6,
+             S.0=26/400,I.0=0.001,R.0=1-26/400
+             ),
            rprocess=euler.sim(
              step.fun="_sir_euler_simulator",
              delta.t=1/52/20,
@@ -42,16 +259,8 @@
            }
            )
 
-coef(po) <- c(
-              gamma=26,mu=0.02,iota=0.01,
-              beta1=400,beta2=480,beta3=320,
-              beta.sd=1e-3,
-              pop=2.1e6,
-              rho=0.6,
-              S.0=26/400,I.0=0.001,R.0=1-26/400
-              )
+## the following was originally used to generate the data
+## simulate(po,nsim=1,seed=329343545L) -> euler.sir
 
-simulate(po,nsim=1,seed=329343545L) -> euler.sir
-
-assign("euler.sir",euler.sir,envir=.GlobalEnv)
+assign("euler.sir",po,envir=.GlobalEnv)
 c("euler.sir")

Modified: pkg/pomp/inst/examples/gillespie.sir.R
===================================================================
--- pkg/pomp/inst/examples/gillespie.sir.R	2013-01-16 11:50:16 UTC (rev 818)
+++ pkg/pomp/inst/examples/gillespie.sir.R	2013-01-16 11:51:10 UTC (rev 819)
@@ -1,75 +1,592 @@
 require(pomp)
 
-po <- pomp(
-           data=data.frame(
-             time=seq(from=0,to=10,by=1/52),
-             reports=NA
-             ),
-           times="time",
-           t0=0,
-           rprocess=gillespie.sim(
-             rate.fun="_sir_rates",
-             PACKAGE="pomp",
-             v=cbind(
-               birth=c(1,0,0,1,0),
-               sdeath=c(-1,0,0,-1,0),
-               infection=c(-1,1,0,0,0),
-               ideath=c(0,-1,0,-1,0),
-               recovery=c(0,-1,1,0,1),
-               rdeath=c(0,0,-1,-1,0)
-               ),
-             d=cbind(
-               birth=c(0,0,0,1,0),
-               sdeath=c(1,0,0,0,0),
-               infection=c(1,1,0,1,0),
-               ideath=c(0,1,0,0,0),
-               recovery=c(0,1,0,0,0),
-               rdeath=c(0,0,1,0,0)
-               )
-             ),
-           skeleton.type="vectorfield",
-           skeleton="_sir_ODE",
-           measurement.model=reports~binom(size=cases,prob=rho),
-           PACKAGE="pomp",
-           obsnames = c("reports"),
-           statenames=c("S","I","R","N","cases"),
-           paramnames=c(
-             "gamma","mu","iota",
-             "beta1","beta.sd","pop","rho",
-             "S.0","I.0","R.0"
-             ),
-           zeronames=c("cases"),
-           comp.names=c("S","I","R"),
-           ic.names=c("S.0","I.0","R.0"),
-           parameter.transform="_sir_par_trans",
-           parameter.inv.transform="_sir_par_untrans",
-           nbasis=3L,
-           degree=3L,
-           period=1.0,
-           initializer=function(params, t0, comp.names, ic.names, ...) {
-             x0 <- numeric(5)
-             names(x0) <- c("S","I","R","N","cases")
-             fracs <- params[ic.names]
-             x0["N"] <- params["pop"]
-             x0[comp.names] <- round(params["pop"]*fracs/sum(fracs))
-             x0
-           }
-           )
+dat <- '"time";"reports"
+0;0
+0,0192307692307692;5
+0,0384615384615385;5
+0,0576923076923077;2
+0,0769230769230769;2
+0,0961538461538462;3
+0,115384615384615;2
+0,134615384615385;2
+0,153846153846154;1
+0,173076923076923;3
+0,192307692307692;2
+0,211538461538462;3
+0,230769230769231;1
+0,25;1
+0,269230769230769;2
+0,288461538461538;1
+0,307692307692308;2
+0,326923076923077;3
+0,346153846153846;1
+0,365384615384615;0
+0,384615384615385;0
+0,403846153846154;2
+0,423076923076923;1
+0,442307692307692;0
+0,461538461538462;1
+0,480769230769231;2
+0,5;0
+0,519230769230769;0
+0,538461538461539;0
+0,557692307692308;1
+0,576923076923077;2
+0,596153846153846;0
+0,615384615384615;1
+0,634615384615385;2
+0,653846153846154;0
+0,673076923076923;2
+0,692307692307692;2
+0,711538461538462;3
+0,730769230769231;1
+0,75;1
+0,769230769230769;0
+0,788461538461539;1
+0,807692307692308;1
+0,826923076923077;0
+0,846153846153846;3
+0,865384615384615;2
+0,884615384615385;10
+0,903846153846154;3
+0,923076923076923;4
+0,942307692307692;2
+0,961538461538462;2
+0,980769230769231;11
+1;4
+1,01923076923077;8
+1,03846153846154;4
+1,05769230769231;1
+1,07692307692308;7
+1,09615384615385;7
+1,11538461538462;5
+1,13461538461538;3
+1,15384615384615;2
+1,17307692307692;7
+1,19230769230769;9
+1,21153846153846;9
+1,23076923076923;5
+1,25;3
+1,26923076923077;4
+1,28846153846154;12
+1,30769230769231;3
+1,32692307692308;11
+1,34615384615385;2
+1,36538461538462;10
+1,38461538461538;9
+1,40384615384615;5
+1,42307692307692;10
+1,44230769230769;10
+1,46153846153846;8
+1,48076923076923;7
+1,5;7
+1,51923076923077;5
+1,53846153846154;10
+1,55769230769231;10
+1,57692307692308;13
+1,59615384615385;14
+1,61538461538462;22
+1,63461538461538;18
+1,65384615384615;22
+1,67307692307692;16
+1,69230769230769;27
+1,71153846153846;24
+1,73076923076923;24
+1,75;36
+1,76923076923077;42
+1,78846153846154;35
+1,80769230769231;43
+1,82692307692308;50
+1,84615384615385;62
+1,86538461538462;47
+1,88461538461538;58
+1,90384615384615;50
+1,92307692307692;57
+1,94230769230769;51
+1,96153846153846;50
+1,98076923076923;54
+2;61
+2,01923076923077;64
+2,03846153846154;58
+2,05769230769231;61
+2,07692307692308;80
+2,09615384615385;48
+2,11538461538462;61
+2,13461538461538;59
+2,15384615384615;59
+2,17307692307692;57
+2,19230769230769;39
+2,21153846153846;42
+2,23076923076923;45
+2,25;55
+2,26923076923077;26
+2,28846153846154;40
+2,30769230769231;50
+2,32692307692308;40
+2,34615384615385;49
+2,36538461538462;44
+2,38461538461538;57
+2,40384615384615;44
+2,42307692307692;56
+2,44230769230769;40
+2,46153846153846;54
+2,48076923076923;59
+2,5;67
+2,51923076923077;52
+2,53846153846154;51
+2,55769230769231;57
+2,57692307692308;66
+2,59615384615385;69
+2,61538461538462;61
+2,63461538461538;63
+2,65384615384615;55
+2,67307692307692;59
+2,69230769230769;59
+2,71153846153846;75
+2,73076923076923;62
+2,75;66
+2,76923076923077;80
+2,78846153846154;53
+2,80769230769231;69
+2,82692307692308;53
+2,84615384615385;56
+2,86538461538462;50
+2,88461538461538;45
+2,90384615384615;41
+2,92307692307692;40
+2,94230769230769;32
+2,96153846153846;39
+2,98076923076923;35
+3;25
+3,01923076923077;32
+3,03846153846154;15
+3,05769230769231;20
+3,07692307692308;19
+3,09615384615385;16
+3,11538461538462;11
+3,13461538461538;14
+3,15384615384615;16
+3,17307692307692;11
+3,19230769230769;8
+3,21153846153846;6
+3,23076923076923;3
+3,25;8
+3,26923076923077;8
+3,28846153846154;2
+3,30769230769231;3
+3,32692307692308;4
+3,34615384615385;8
+3,36538461538462;7
+3,38461538461539;4
+3,40384615384615;9
+3,42307692307692;7
+3,44230769230769;8
+3,46153846153846;5
+3,48076923076923;5
+3,5;7
+3,51923076923077;1
+3,53846153846154;6
+3,55769230769231;7
+3,57692307692308;6
+3,59615384615385;5
+3,61538461538462;8
+3,63461538461539;10
+3,65384615384615;1
+3,67307692307692;0
+3,69230769230769;5
+3,71153846153846;8
+3,73076923076923;1
+3,75;8
+3,76923076923077;8
+3,78846153846154;5
+3,80769230769231;7
+3,82692307692308;3
+3,84615384615385;7
+3,86538461538462;4
+3,88461538461539;6
+3,90384615384615;7
+3,92307692307692;6
+3,94230769230769;7
+3,96153846153846;7
+3,98076923076923;5
+4;5
+4,01923076923077;7
+4,03846153846154;2
+4,05769230769231;8
+4,07692307692308;3
+4,09615384615385;3
+4,11538461538462;5
+4,13461538461539;1
+4,15384615384615;3
+4,17307692307692;5
+4,19230769230769;5
+4,21153846153846;2
+4,23076923076923;3
+4,25;6
+4,26923076923077;1
+4,28846153846154;2
+4,30769230769231;2
+4,32692307692308;5
+4,34615384615385;3
+4,36538461538462;3
+4,38461538461539;7
+4,40384615384615;2
+4,42307692307692;2
+4,44230769230769;2
+4,46153846153846;3
+4,48076923076923;4
+4,5;4
+4,51923076923077;7
+4,53846153846154;1
+4,55769230769231;5
+4,57692307692308;12
+4,59615384615385;5
+4,61538461538462;8
+4,63461538461539;3
+4,65384615384615;17
+4,67307692307692;14
+4,69230769230769;15
+4,71153846153846;12
+4,73076923076923;19
+4,75;19
+4,76923076923077;17
+4,78846153846154;23
+4,80769230769231;28
+4,82692307692308;23
+4,84615384615385;32
+4,86538461538462;24
+4,88461538461539;35
+4,90384615384615;31
+4,92307692307692;23
+4,94230769230769;41
+4,96153846153846;27
+4,98076923076923;28
+5;26
+5,01923076923077;29
+5,03846153846154;38
+5,05769230769231;20
+5,07692307692308;17
+5,09615384615385;29
+5,11538461538462;31
+5,13461538461539;25
+5,15384615384615;31
+5,17307692307692;26
+5,19230769230769;23
+5,21153846153846;36
+5,23076923076923;25
+5,25;25
+5,26923076923077;35
+5,28846153846154;37
+5,30769230769231;32
+5,32692307692308;30
+5,34615384615385;41
+5,36538461538462;45
+5,38461538461539;61
+5,40384615384615;40
+5,42307692307692;43
+5,44230769230769;46
+5,46153846153846;49
+5,48076923076923;59
+5,5;48
+5,51923076923077;69
+5,53846153846154;61
+5,55769230769231;68
+5,57692307692308;79
+5,59615384615385;91
+5,61538461538462;93
+5,63461538461539;77
+5,65384615384615;87
+5,67307692307692;107
+5,69230769230769;103
+5,71153846153846;119
+5,73076923076923;111
+5,75;110
+5,76923076923077;91
+5,78846153846154;120
+5,80769230769231;106
+5,82692307692308;93
+5,84615384615385;69
+5,86538461538462;90
+5,88461538461539;100
+5,90384615384615;73
+5,92307692307692;72
+5,94230769230769;67
+5,96153846153846;63
+5,98076923076923;41
+6;43
+6,01923076923077;33
+6,03846153846154;40
+6,05769230769231;29
+6,07692307692308;25
+6,09615384615385;22
+6,11538461538462;19
+6,13461538461539;15
+6,15384615384615;18
+6,17307692307692;13
+6,19230769230769;15
+6,21153846153846;14
+6,23076923076923;10
+6,25;8
+6,26923076923077;13
+6,28846153846154;4
+6,30769230769231;10
+6,32692307692308;3
+6,34615384615385;9
+6,36538461538462;10
+6,38461538461539;9
+6,40384615384615;4
+6,42307692307692;4
+6,44230769230769;3
+6,46153846153846;2
+6,48076923076923;6
+6,5;4
+6,51923076923077;5
+6,53846153846154;3
+6,55769230769231;8
+6,57692307692308;3
+6,59615384615385;6
+6,61538461538462;5
+6,63461538461539;6
+6,65384615384615;1
+6,67307692307692;8
+6,69230769230769;12
+6,71153846153846;10
+6,73076923076923;3
+6,75;3
+6,76923076923077;6
+6,78846153846154;5
+6,80769230769231;10
+6,82692307692308;6
+6,84615384615385;6
+6,86538461538462;5
+6,88461538461539;11
+6,90384615384615;6
+6,92307692307692;14
+6,94230769230769;7
+6,96153846153846;6
+6,98076923076923;5
+7;4
+7,01923076923077;7
+7,03846153846154;3
+7,05769230769231;4
+7,07692307692308;3
+7,09615384615385;3
+7,11538461538462;2
+7,13461538461539;3
+7,15384615384615;7
+7,17307692307692;2
+7,19230769230769;2
+7,21153846153846;3
+7,23076923076923;3
+7,25;5
+7,26923076923077;2
+7,28846153846154;3
+7,30769230769231;7
+7,32692307692308;2
+7,34615384615385;6
+7,36538461538462;2
+7,38461538461539;5
+7,40384615384615;5
+7,42307692307692;6
+7,44230769230769;5
+7,46153846153846;8
+7,48076923076923;9
+7,5;5
+7,51923076923077;5
+7,53846153846154;15
+7,55769230769231;9
+7,57692307692308;18
+7,59615384615385;17
+7,61538461538462;10
+7,63461538461539;16
+7,65384615384615;15
+7,67307692307692;19
+7,69230769230769;14
+7,71153846153846;23
+7,73076923076923;28
+7,75;32
+7,76923076923077;32
+7,78846153846154;31
+7,80769230769231;40
+7,82692307692308;37
+7,84615384615385;41
+7,86538461538462;37
+7,88461538461539;40
+7,90384615384615;38
+7,92307692307692;44
+7,94230769230769;35
+7,96153846153846;34
+7,98076923076923;26
+8;49
+8,01923076923077;32
+8,03846153846154;45
+8,05769230769231;38
+8,07692307692308;31
+8,09615384615385;26
+8,11538461538461;27
+8,13461538461539;26
+8,15384615384616;26
+8,17307692307692;22
+8,19230769230769;33
+8,21153846153846;36
+8,23076923076923;27
+8,25;36
+8,26923076923077;39
+8,28846153846154;36
+8,30769230769231;30
+8,32692307692308;39
+8,34615384615385;28
+8,36538461538461;31
+8,38461538461539;40
+8,40384615384616;47
+8,42307692307692;41
+8,44230769230769;42
+8,46153846153846;42
+8,48076923076923;50
+8,5;60
+8,51923076923077;53
+8,53846153846154;64
+8,55769230769231;59
+8,57692307692308;65
+8,59615384615385;61
+8,61538461538462;69
+8,63461538461539;66
+8,65384615384616;71
+8,67307692307692;71
+8,69230769230769;72
+8,71153846153846;94
+8,73076923076923;79
+8,75;79
+8,76923076923077;78
+8,78846153846154;78
+8,80769230769231;92
+8,82692307692308;64
+8,84615384615385;70
+8,86538461538462;50
+8,88461538461539;63
+8,90384615384616;58
+8,92307692307692;53
+8,94230769230769;48
+8,96153846153846;51
+8,98076923076923;28
+9;36
+9,01923076923077;40
+9,03846153846154;20
+9,05769230769231;16
+9,07692307692308;19
+9,09615384615385;16
+9,11538461538462;20
+9,13461538461539;16
+9,15384615384616;11
+9,17307692307692;9
+9,19230769230769;15
+9,21153846153846;15
+9,23076923076923;7
+9,25;12
+9,26923076923077;9
+9,28846153846154;5
+9,30769230769231;4
+9,32692307692308;3
+9,34615384615385;4
+9,36538461538462;4
+9,38461538461539;5
+9,40384615384616;3
+9,42307692307692;2
+9,44230769230769;2
+9,46153846153846;3
+9,48076923076923;3
+9,5;5
+9,51923076923077;3
+9,53846153846154;3
+9,55769230769231;6
+9,57692307692308;6
+9,59615384615385;5
+9,61538461538462;2
+9,63461538461539;5
+9,65384615384616;5
+9,67307692307692;3
+9,69230769230769;3
+9,71153846153846;3
+9,73076923076923;4
+9,75;3
+9,76923076923077;9
+9,78846153846154;4
+9,80769230769231;2
+9,82692307692308;5
+9,84615384615385;4
+9,86538461538462;2
+9,88461538461539;4
+9,90384615384616;5
+9,92307692307692;3
+9,94230769230769;2
+9,96153846153846;3
+9,98076923076923;2
+10;6
+'
 
-coef(po) <- c(
-              gamma=24,mu=1/70,iota=0.1,
-              beta1=330,beta2=410,beta3=490,
-              rho=0.1,
-              S.0=0.05,I.0=1e-4,R.0=0.95,
-              pop=1000000,
-              beta.sd=0
-              )
+pomp(
+     data=read.csv2(textConnection(dat)),
+     times="time",
+     t0=0,
+     params=c(
+       gamma=24,mu=1/70,iota=0.1,
+       beta1=330,beta2=410,beta3=490,
+       rho=0.1,
+       S.0=0.05,I.0=1e-4,R.0=0.95,
+       pop=1000000,
+       beta.sd=0
+       ),
+     rprocess=gillespie.sim(
+       rate.fun="_sir_rates",
+       PACKAGE="pomp",
+       v=cbind(
+         birth=c(1,0,0,1,0),
+         sdeath=c(-1,0,0,-1,0),
+         infection=c(-1,1,0,0,0),
+         ideath=c(0,-1,0,-1,0),
+         recovery=c(0,-1,1,0,1),
+         rdeath=c(0,0,-1,-1,0)
+         ),
+       d=cbind(
+         birth=c(0,0,0,1,0),
+         sdeath=c(1,0,0,0,0),
+         infection=c(1,1,0,1,0),
+         ideath=c(0,1,0,0,0),
+         recovery=c(0,1,0,0,0),
+         rdeath=c(0,0,1,0,0)
+         )
+       ),
+     skeleton.type="vectorfield",
+     skeleton="_sir_ODE",
+     measurement.model=reports~binom(size=cases,prob=rho),
+     PACKAGE="pomp",
+     obsnames = c("reports"),
+     statenames=c("S","I","R","N","cases"),
+     paramnames=c(
+       "gamma","mu","iota",
+       "beta1","beta.sd","pop","rho",
+       "S.0","I.0","R.0"
+       ),
+     zeronames=c("cases"),
+     comp.names=c("S","I","R"),
+     ic.names=c("S.0","I.0","R.0"),
+     parameter.transform="_sir_par_trans",
+     parameter.inv.transform="_sir_par_untrans",
+     nbasis=3L,
+     degree=3L,
+     period=1.0,
+     initializer=function(params, t0, comp.names, ic.names, ...) {
+       x0 <- numeric(5)
+       names(x0) <- c("S","I","R","N","cases")
+       fracs <- params[ic.names]
+       x0["N"] <- params["pop"]
+       x0[comp.names] <- round(params["pop"]*fracs/sum(fracs))
+       x0
+     }
+     ) -> po
 
-simulate(
-         po,
-         nsim=1,
-         seed=1165270654L
-         ) -> gillespie.sir
+## originally, the data were created via:
+## simulate(po,nsim=1,seed=1165270654L) -> gillespie.sir
 
-assign("gillespie.sir",gillespie.sir,envir=.GlobalEnv)
+assign("gillespie.sir",po,envir=.GlobalEnv)
 c("gillespie.sir")

Modified: pkg/pomp/inst/examples/gompertz.R
===================================================================
--- pkg/pomp/inst/examples/gompertz.R	2013-01-16 11:50:16 UTC (rev 818)
+++ pkg/pomp/inst/examples/gompertz.R	2013-01-16 11:51:10 UTC (rev 819)
@@ -1,9 +1,114 @@
 require(pomp)
 
+dat <- '"time";"X";"Y"
+0;1;1,07952841598157
+1;0,950636618475229;1,11861594539405
+2;0,83244916029991;0,828286900987495
+3;0,93103099656842;1,13600466557311
+4;0,911439385512777;0,806676551188204
+5;0,837105441016674;0,873084434929483
+6;1,00268501398128;1,04124835021771
+7;1,06579807727341;1,05979968381669
+8;1,04671681272393;1,14368595456944
+9;1,01143788899437;1,17581280964431
+10;1,12153364435953;1,16125775736251
+11;1,23274218227861;1,22891596556583
+12;1,32655395564463;1,38234823254117
+13;1,35069512981151;1,13856582462482
+14;1,13875163542966;1,10278598215362
+15;1,26066897039704;1,29730413792106
+16;1,24543791707035;1,33112792763266
+17;1,23134905281316;1,20013316479374
+18;1,15533668996193;1,1748481850297
+19;1,19423810951996;1,37677723538777
+20;1,20635310746995;1,30467220974374
+21;1,04307227953634;0,933048055379677
+22;1,04107912990884;1,08563062740614
+23;1,00318246871677;1,02180297594675
+24;0,970849938478495;1,25099936514459
+25;0,79243164319502;0,79761814762639
+26;0,771762127953167;0,68253288426557
+27;0,760988977405389;0,785573183621746
+28;0,836517935205031;0,880032437134315
+29;0,7939171601806;0,817662333089958
+30;0,723293224297652;0,682204778379272
+31;0,775999242794153;0,609158268599648
+32;0,801813842772822;0,953075868457542
+33;0,76994574267228;0,64000611215012
+34;0,746021978630474;0,824778708853423
+35;0,81336335287903;0,75477831785326
+36;0,923882876057083;1,05020086682025
+37;1,02216853265321;1,07915643829565
+38;0,953397077328701;0,910377207219948
+39;1,01222135734455;1,07196221241156
+40;0,978288274555936;0,927402543398725
+41;1,07783628249536;1,13562270683309
+42;1,18185012207163;1,15138433126514
+43;0,952520534180798;0,979766621130238
+44;0,84439364958955;0,932583376950161
+45;0,85025855989352;0,874190322172554
+46;0,868591242831582;0,917317195376153
+47;0,96734181848679;0,810217908784557
+48;0,90424208054782;0,91751282983596
+49;0,77998160754507;0,777229472252738
+50;0,807245881695201;0,984536558782125
+51;0,796994124555762;0,829289645018853
+52;0,811536735801658;0,738549113698673
+53;0,817376297833073;0,751664773418347
+54;0,911274275731693;0,901320737117393
+55;1,09671858179842;1,02114400728858
+56;1,17782304259497;1,15480952716325
+57;1,48974254173377;1,52171146422867
+58;1,59363218853134;1,60303998339523
+59;1,33894250041079;1,3673888909755
+60;1,24282152770653;1,07557075960246
+61;1,21473587944885;1,26679772028961
+62;1,31898738946143;1,22392737161959
+63;1,45195233453426;1,40639369164472
+64;1,58364437767931;1,61885414154031
+65;1,60727226980948;1,70623639556045
+66;1,55648312498095;1,87962959035064
+67;1,66568956879442;1,73633383185204
+68;1,71151559987914;1,59157235244771
+69;1,53634236355877;1,58129601393277
+70;1,62285253887348;1,66169160756609
+71;1,27898023105463;1,35952077984963
+72;1,1818761514106;1,22549784715231
+73;1,09002630947639;1,2025122303878
+74;1,2232879353834;1,25096891846816
+75;1,43006968443063;1,41018069268411
+76;1,41189860111872;1,43675715990225
+77;1,55201995283258;1,44229999201853
+78;1,45818570565819;1,38883706742128
+79;1,22002519977696;1,25058856058262
+80;1,23865238275549;1,23288019435894
+81;1,48621496132753;1,58848483557968
+82;1,36483886467245;1,23628960315986
+83;1,51299070383272;1,60393599831722
+84;1,25759262244331;1,1541357227336
+85;1,19746015105645;1,35609775043505
+86;1,05742547057021;0,855756862528805
+87;1,22304508672589;1,38718382523001
+88;1,25379301734834;1,24797305664899
+89;1,13949050640685;1,35307215916429
+90;0,817425730431819;0,970652163066452
+91;0,802233823759296;0,847914335870894
+92;0,857912063302802;0,897827069767532
+93;1,05787680391846;1,16338321886402
+94;1,05448994160666;1,04849780806396
+95;1,11773425002073;1,02168552045925
+96;1,03321705886828;1,23012631227719
+97;0,985172093658399;1,06931864474828
+98;0,942026595214108;1,14999282942163
+99;1,16257505590149;0,972309774206453
+100;1,28071364632546;1,23495259845453
+'
+
 po <- pomp(
-           data=data.frame(time=seq(0,100,by=1),Y=NA),
+           data=read.csv2(textConnection(dat)),
            times="time",
            t0=0,
+           params=c(K=1,r=0.1,sigma=0.1,tau=0.1,X.0=1),
            rprocess=discrete.time.sim(
              step.fun="_gompertz_simulator"
              ),
@@ -22,9 +127,8 @@
            }
            )
 
-coef(po) <- c(K=1,r=0.1,sigma=0.1,tau=0.1,X.0=1)
+## the following was used to create the data included
+## simulate(po,nsim=1,seed=299438676L) -> gompertz
 
-simulate(po,nsim=1,seed=299438676L) -> gompertz
-
-assign("gompertz",gompertz,envir=.GlobalEnv)
+assign("gompertz",po,envir=.GlobalEnv)
 c("gompertz")

Modified: pkg/pomp/inst/examples/ou2.R
===================================================================
--- pkg/pomp/inst/examples/ou2.R	2013-01-16 11:50:16 UTC (rev 818)
+++ pkg/pomp/inst/examples/ou2.R	2013-01-16 11:51:10 UTC (rev 819)
@@ -1,40 +1,133 @@
 require(pomp)
 
-simulate(
-         pomp( 
-              times=seq(1,101),
-              data=rbind(
-                y1=rep(0,101),
-                y2=rep(0,101)
-                ),
-              t0=1,
-              rprocess=discrete.time.sim("ou2_step",PACKAGE="pomp"),
-              dprocess=onestep.dens("ou2_pdf",PACKAGE="pomp"),
-              dmeasure = "ou2_dmeasure",
-              rmeasure = "ou2_rmeasure",
-              skeleton.type="map",
-              skeleton = "ou2_skel",
-              PACKAGE="pomp",
-              paramnames = c(
-                "alpha.1","alpha.2","alpha.3","alpha.4",
-                "sigma.1","sigma.2","sigma.3",
-                "tau"
-                ),
-              statenames = c("x1","x2"),
-              obsnames = c("y1","y2")
-              ),
-         params=c(
-           alpha.1=0.8, alpha.2=-0.5, alpha.3=0.3, alpha.4=0.9,
-           sigma.1=3, sigma.2=-0.5, sigma.3=2,
-           tau=1, 
-           x1.0=-3, x2.0=4
-           ),
-         nsim=1,
-         seed=377456545L
-         ) -> ou2
+dat <- '"time";"y1";"y2"
+1;-1,70081613181228;4,24746468495763
+2;0,242170113354698;7,03941580692464
+3;3,76758938785925;2,97520908716299
+4;5,68588808149477;-1,47040054732921
+5;3,77452601600709;-4,43380857201258
+6;-3,08021312625511;-3,91887931755601
+7;-2,62344860290795;-1,03202457662666
+8;-2,86592128836057;4,35432873921529
+9;-0,57760946681527;3,39758289565346
+10;2,74097620676726;4,91071465265353
+11;-0,95441253676346;10,1937011763325
+12;-0,991464112428821;6,61823476151473
+13;3,84297778313153;7,16145392465002
+14;11,0789623105051;4,16444989466932
+15;8,59819025333584;-4,90334695500249
+16;2,19964347503517;-10,2511439107283
+17;-1,13492397511025;-10,3624312929729
+18;-2,56413579798821;-8,16885880550387
+19;-4,91536849799727;-7,2203116145846
+20;-4,33899642531645;-2,31022153289937
+21;-1,35937286561288;2,99698279033669
+22;-4,0242840268505;3,69116465405162
+23;2,9387644957218;6,15414586126603
+24;4,31828658150857;5,69290844809883
+25;3,53319543208941;3,46054629112961
+26;6,44281783433088;-4,79748856413256
+27;0,718035321052913;-7,62976005316743
+28;1,28027528075623;-6,25270934959545
+29;3,70910008919496;-9,94125507650066
+30;1,48104366840107;-10,2850854614516
+31;-0,209117126395869;-8,80046618352614
+32;-5,81639714549404;-13,2283385097361
+33;-10,0225182259708;-6,4113389217938
+34;-6,89506104214256;-0,998400718547352
+35;-6,08611873904796;1,29299352993825
+36;-7,74305796307499;5,90263448168222
+37;0,0287081408447805;5,88274335246936
+38;9,62512958922631;2,54860024892302
+39;4,61772012246597;-4,51699357410536
+40;-1,40028864684968;-3,66192759013006
+41;-6,10811040670547;-4,38003912739696
+42;-0,658058036920092;-1,7236046423518
+43;-3,49326574531689;-4,14959269754278
+44;2,54826871576915;-1,40873093710545
+45;-0,640114486048052;0,896862978414845
+46;-1,67566665036179;0,379384529694427
+47;0,488141779118929;2,07741847310818
+48;0,975197260459797;2,83822178936221
+49;-1,0207098675894;0,112186038274661
+50;0,0342598900248652;3,50605179482128
+51;-2,39842556182189;2,92854885312383
+52;5,19015239107048;-0,0089221935515531
+53;4,14310779510487;0,268899079252409
+54;2,63260618646816;1,60371893328454
+55;-1,55607266713321;-0,764379706108408
+56;-0,545766983243217;-0,837246196106889
+57;1,34912551213756;-4,15285169037281
+58;0,970330264719094;0,379978231358855
+59;-5,04652345030695;-0,444477177942712
+60;-3,97209430320528;1,10490455647656
+61;-3,20325965055922;5,69632695844117
+62;1,03436272221434;7,86129746544832
+63;0,667898750837872;10,4068175981576
+64;3,50430639591665;9,2816749036714
+65;0,925079731276049;5,05429708955105
+66;1,46558192088153;0,403851869094214
+67;2,69317536547979;-4,51756265008713
+68;-2,41608073604264;-8,3370959564069
+69;-4,53015031919341;-3,20513929382432
+70;-11,0133845324347;-1,33315487824171
+71;-10,7508370993112;5,17621264446314
+72;-10,5218612264298;8,61966772995883
+73;-8,57143649619155;11,4982952428018
+74;-3,99562214384817;12,5937325399812
+75;-2,71455145450133;15,5796601067951
+76;0,512617531996642;16,8599826830534
+77;8,77766626349685;11,8289064956647
+78;9,92868196527894;5,40891154021026
+79;4,66011726941136;1,15575075091348
+80;2,67821752937628;-0,585565498904033
+81;1,15068730079675;-5,26069159041533
+82;-2,203829735812;-7,73574749590483
+83;-1,36113119160702;-6,51696428184672
+84;-4,49088592785424;-6,88875950760792
+85;-6,95435086585582;-5,73210381080353
+86;-7,54286719246903;-2,04743677554387
+87;-7,25975156626116;-1,10509448997233
+88;-5,31555444374504;2,94363686064014
+89;1,9728018375925;4,08030586218171
+90;2,87436582964618;1,2087743319357
+91;2,96600944673318;1,85680168956727
+92;4,63179378892858;3,07085679112279
+93;5,62360583343836;-2,89483235988436
+94;1,87661311794902;-3,00789937429844
+95;-0,0144619140532691;-2,67204400181558
+96;1,94214418106964;-6,14711561527305
+97;1,98468512734267;-5,61898548532659
+98;-1,41012196458721;-11,086585198673
+99;-7,29715227580992;-4,07855448780968
+100;-4,81538906352058;-1,00365875150418
+'
 
-ou2 <- window(ou2,end=100)
-timezero(ou2) <- 0
+pomp( 
+     data=read.csv2(textConnection(dat)),
+     times="time",
+     t0=0,
+     rprocess=discrete.time.sim("ou2_step",PACKAGE="pomp"),
+     dprocess=onestep.dens("ou2_pdf",PACKAGE="pomp"),
+     dmeasure = "ou2_dmeasure",
+     rmeasure = "ou2_rmeasure",
+     skeleton.type="map",
+     skeleton = "ou2_skel",
+     PACKAGE="pomp",
+     paramnames = c(
+       "alpha.1","alpha.2","alpha.3","alpha.4",
+       "sigma.1","sigma.2","sigma.3",
+       "tau"
+       ),
+     statenames = c("x1","x2"),
+     obsnames = c("y1","y2"),
+     params=c(
+       alpha.1=0.8, alpha.2=-0.5, alpha.3=0.3, alpha.4=0.9,
+       sigma.1=3, sigma.2=-0.5, sigma.3=2,
+       tau=1, 
+       x1.0=-3, x2.0=4
+       )
+     ) -> po
 
-assign("ou2",ou2,envir=.GlobalEnv)
+assign("ou2",po,envir=.GlobalEnv)
 c("ou2")

Modified: pkg/pomp/inst/examples/ricker.R
===================================================================
--- pkg/pomp/inst/examples/ricker.R	2013-01-16 11:50:16 UTC (rev 818)
+++ pkg/pomp/inst/examples/ricker.R	2013-01-16 11:51:10 UTC (rev 819)
@@ -1,40 +1,84 @@
 require(pomp)
 
-simulate(
-         pomp(
-              data=data.frame(time=seq(0,50,by=1),y=NA),
-              times="time",
-              t0=0,
-              rprocess=discrete.time.sim(
-                step.fun="_ricker_simulator"
-                ),
-              rmeasure="_ricker_poisson_rmeasure",
-              dmeasure="_ricker_poisson_dmeasure",
-              skeleton.type="map",
-              skeleton="_ricker_skeleton",
-              paramnames=c("r","sigma","phi"),
-              statenames=c("N","e"),
-              obsnames=c("y"),
-              parameter.inv.transform=function(params,...) {
-                params[c("r","sigma","phi","N.0")] <- log(params[c("r","sigma","phi","N.0")])
-                params
-              },
-              parameter.transform=function(params,...) {
-                params[c("r","sigma","phi","N.0")] <- exp(params[c("r","sigma","phi","N.0")])
-                params
-              },
-              PACKAGE="pomp"
-              ),
-         params=c(
-           r=exp(3.8),
-           sigma=0.3,
-           phi=10,
-           N.0=7,
-           e.0=0
-           ),
-         nsim=1,
-         seed=73691676L
-         ) -> ricker
+dat <- '"time";"y"
+0;68
+1;2
+2;87
+3;0
+4;12
+5;174
+6;0
+7;0
+8;1
+9;57
+10;11
+11;178
+12;0
+13;1
+14;0
+15;34
+16;72
+17;3
+18;101
+19;0
+20;8
+21;156
+22;0
+23;0
+24;3
+25;93
+26;0
+27;17
+28;121
+29;0
+30;0
+31;19
+32;107
+33;0
+34;4
+35;127
+36;0
+37;1
+38;47
+39;8
+40;117
+41;0
+42;3
+43;82
+44;2
+45;39
+46;70
+47;11
+48;275
+49;0
+50;0
+'
 
-assign("ricker",ricker,envir=.GlobalEnv)
+pomp(
+     data=read.csv2(textConnection(dat)),
+     times="time",
+     t0=0,
+     params=c(r=exp(3.8),sigma=0.3,phi=10,N.0=7,e.0=0), # originally used to generate the data
+     rprocess=discrete.time.sim(
+       step.fun="_ricker_simulator"
+       ),
+     rmeasure="_ricker_poisson_rmeasure",
+     dmeasure="_ricker_poisson_dmeasure",
+     skeleton.type="map",
+     skeleton="_ricker_skeleton",
+     paramnames=c("r","sigma","phi"),
+     statenames=c("N","e"),
+     obsnames=c("y"),
+     parameter.inv.transform=function(params,...) {
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/pomp -r 819


More information about the pomp-commits mailing list