R Under development (unstable) (2023-08-05 r84874 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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(efdm) > > statespace <- expand.grid(ds=c("sp", "pi"), region=c("n", "s"), vol=1:3, stringsAsFactors=FALSE) > statespace$split <- statespace$ds == "sp" & statespace$region == "n" > pairdata <- data.frame(ds=c("sp", "pi"), vol0=c(1,1), vol1=c(2,3), region=c("n", "s")) > pairdata$split <- pairdata$ds == "sp" & pairdata$region == "n" > actprob <- state0 <- statespace > actprob$test <- 1 > state0$area <- c(1,1,1,1, 0,0,0,0, 0,0,0,0) > > act1 <- define_activity("test", c("vol")) > transprobs(act1) <- estimatetransprobs("vol", pairdata, statespace, factors=c("region"), by=c("split", "ds"), prior="nochange") > r1 <- runEFDM(state0, actprob, list(act1), 10) > > statespace <- expand.grid(ds=c("sp", "pi"), region=c("n", "s"), vol=1:3) > statespace$split <- statespace$ds == "sp" & statespace$region == "n" > pairdata <- data.frame(ds=c("sp", "pi"), vol0=c(1,1), vol1=c(2,3), region=c("n", "s")) > pairdata$split <- pairdata$ds == "sp" & pairdata$region == "n" > actprob <- state0 <- statespace > actprob$test <- 1 > state0$area <- c(1,1,1,1, 0,0,0,0, 0,0,0,0) > > act1 <- define_activity("test", c("vol")) > transprobs(act1) <- estimatetransprobs("vol", pairdata, statespace, factors=c("region"), by=c("split", "ds"), prior="nochange") > r2 <- runEFDM(state0, actprob, list(act1), 10) > r1$ds <- factor(r1$ds, levels=c("sp", "pi")) > r1$region <- factor(r1$region, levels=c("n", "s")) > sortdf <- function(x) x[do.call(order, x),] > stopifnot(all(sortdf(r1)==sortdf(r2))) > > > proc.time() user system elapsed 0.51 0.04 0.54