R Under development (unstable) (2024-02-17 r85935 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. > > library(spatPomp) Loading required package: pomp > > p_expanded <- c(a1=0,b1=0,b2=1,b3=2,c1=4,c2=4,c3=4) > > p_contracted <- contract_params(p_expanded,expandedParNames="c",U=3) > > p_contracted a1 b1 b2 b3 c1 0 0 1 2 4 > > p_expanded2 <- expand_params(p_contracted,expandedParNames="c",U=3) > > p_expanded2 c1 c2 c3 a1 b1 b2 b3 4 4 4 0 0 1 2 > > if(any(p_expanded[names(p_expanded2)]!=p_expanded2)) stop( + "failed inverse for expand_params() and contract_params()" + ) > > mean_by_unit(p_expanded,expandedParNames=c("b","c"),U=3) a1 b1 b2 b3 c1 c2 c3 0 1 1 1 4 4 4 > > mean_by_unit(p_expanded,expandedParNames=c("c"),U=3) a1 b1 b2 b3 c1 c2 c3 0 0 1 2 4 4 4 > > > proc.time() user system elapsed 0.95 0.06 1.00