R Under development (unstable) (2024-09-06 r87103 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. 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. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if (file.exists("_options.R")) source("_options.R") > library(panelPomp,quietly=TRUE) > > TESTS_PASS <- NULL > test <- function(expr1,expr2,all="TESTS_PASS",env=parent.frame(),...) + panelPomp:::test(expr1,expr2,all=all,env=env,...) > > g <- panelGompertz(N=5,U=2) > estNames<- c("r",paste0("tau[unit",1:length(g),"]")) > theta_start <- coef(g)[estNames] > gLik <- panelGompertzLikelihood(theta_start,g,coef(g)) > gLik [1] -2.122622 > > pomp::stew(file="panelGompertzLikelihood.rda",seed=2358,{ + g_pfLik <- logLik(pfilter(g,Np=5000)) + }) > test(abs(g_pfLik-gLik)<1,TRUE) [1] TRUE > > gMLE <- optim( + par=theta_start, + fn=panelGompertzLikelihood, + panelPompObject=g, + params=coef(g), + hessian=TRUE, + control=list(trace=0,fnscale=-1) + ) > > gMLE$val [1] -0.6954027 > gMLE$par r tau[unit1] tau[unit2] -0.05145418 0.14961755 0.17785801 > theta_start r tau[unit1] tau[unit2] 0.1 0.1 0.1 > > ## check whether all tests passed > all(get(eval(formals(test))$all)) [1] TRUE > if (!all(get(eval(formals(test))$all))) stop("Not all tests passed!") > > proc.time() user system elapsed 1.09 0.09 2.82