Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kingaa committed Jun 3, 2024
1 parent c784574 commit e54664e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 42 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: phylopomp
Type: Package
Title: Phylodynamic Inference for POMP Models
Version: 0.13.1.1
Date: 2024-05-28
Version: 0.13.1.2
Date: 2024-06-03
Authors@R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="[email protected]",comment=c(ORCID="0000-0001-6159-3207")),
person(given=c("Qianying"),family="Lin",role=c("aut"),comment=c(ORCID="0000-0001-8620-9910"))
)
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ importFrom(grid,upViewport)
importFrom(grid,viewport)
importFrom(pomp,bake)
importFrom(pomp,covariate_table)
importFrom(pomp,euler)
importFrom(pomp,freeze)
importFrom(pomp,onestep)
importFrom(pomp,pomp)
Expand Down
2 changes: 1 addition & 1 deletion R/lbdp.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ lbdp_exact <- function (x, lambda, mu, psi, n0 = 1) {
##' @rdname lbdp
##' @details
##' \code{lbdp_pomp} constructs a \pkg{pomp} object containing a given set of data and a linear birth-death-sampling process.
##' @importFrom pomp pomp onestep euler covariate_table
##' @importFrom pomp pomp onestep covariate_table
##' @inheritParams lbdp_exact
##' @export
lbdp_pomp <- function (x, lambda, mu, psi, n0 = 1, t0 = 0)
Expand Down
2 changes: 1 addition & 1 deletion src/seirs_pomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "internal.h"

static inline int random_choice (double n) {
return (int) floor(R_unif_index(n));
return random_integer((int) nearbyint(n));
}

static void change_color (double *color, int nsample,
Expand Down
2 changes: 2 additions & 0 deletions tests/gendat.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Expand Down
Binary file modified tests/seir2-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/seir2-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 37 additions & 37 deletions tests/seir2.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -59,47 +59,47 @@ Error : in 'seirs_pomp': 'S0','E0','I0','R0' must be nonnegative integers.
>
> po |> rinit(nsim=5)
.id
name [,1] [,2] [,3] [,4] [,5]
S 100 100 100 100 100
E 3 3 3 3 3
I 5 5 5 5 5
R 100 100 100 100 100
ll 0 0 0 0 0
node 5 5 5 5 5
ellE 3 3 3 3 2
ellI 3 3 3 3 4
color 1 0 1 1 1
0 1 1 1 0
1 0 0 0 1
NA NA NA NA NA
0 1 1 0 1
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
1 0 0 0 1
0 1 0 1 0
name [,1] [,2] [,3] [,4] [,5]
S 100.000 100.00 100.00 100.00 100.000
E 3.000 3.00 3.00 3.00 3.000
I 5.000 5.00 5.00 5.00 5.000
R 100.000 100.00 100.00 100.00 100.000
ll 0.624 1.03 1.03 1.03 0.624
node 5.000 5.00 5.00 5.00 5.000
ellE 2.000 3.00 3.00 3.00 2.000
ellI 4.000 3.00 3.00 3.00 4.000
color 1.000 0.00 1.00 1.00 1.000
0.000 1.00 1.00 1.00 0.000
1.000 0.00 0.00 0.00 1.000
NA NA NA NA NA
0.000 1.00 1.00 0.00 1.000
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
NA NA NA NA NA
1.000 0.00 0.00 0.00 1.000
1.000 1.00 0.00 1.00 0.000
>
> po |> pfilter(Np=1000) |> replicate(n=20) |> concat() -> pf
> pf |> logLik()
[1] -33.0 -32.8 -33.1 -33.9 -33.6 -33.4 -33.0 -32.6 -34.5 -32.8 -33.3 -33.5
[13] -33.4 -33.6 -34.4 -32.7 -33.5 -31.5 -34.3 -32.8
[1] -32.4 -32.0 -30.2 -30.2 -28.9 -28.7 -31.7 -31.4 -31.5 -30.1 -30.6 -31.2
[13] -30.9 -30.8 -28.4 -29.9 -31.5 -30.8 -32.1 -30.3
> pf |> logLik() |> logmeanexp(se=TRUE,ess=TRUE)
est se ess
-33.01 0.23 10.80
est se ess
-30.041 0.325 7.337
>
> pf |> plot(type="s")
>
Expand Down

0 comments on commit e54664e

Please sign in to comment.