-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi Team,
just wondering if you've come across the following error when running power analyses with package:
exit diagonal hessian due to early_stop
enable early_stop ff < f0: -28.961324 < -28.958817 (diff -0.00250704)
MRE below:
all.BACI.posterior <- list()
all.hyper.posterior <- list()
for(r in 1:nrow(resp.types)){
var.r <- resp.types[r, "Spp.group"]
use.dat <- BACI_eDNA_dat_abund %>%
mutate(response=BACI_eDNA_dat_abund[, var.r]) %>%
# mutate(response=BACI_eDNA_dat_abund$Everything) %>%
dplyr::select(c("response", "Zone", "set", "trip", "BvA", "CvI","replicate")) %>%
na.omit()
dataComponents<-supplyData(
dat=use.dat,
variableType="nbinomial",
design.matrix=list(
Response="response", # get the rth response variable
Trials=NA,
Location="set",
sublocation="replicate",
Time="trip",
subtime=NA,
BvA="BvA",
CvI="CvI"),
levels.dat=list(
Before="before",
Control="control",
After="after",
Impact="impact"),
scenario.data=list(
Number.of.iterations=50,
filename=paste("abundance_", var.r,"_set_replicate",sep=""), # save all the output with the response variable name
Number.of.Impact.Locations=3,
Number.of.Control.Locations=6,
Number.of.sublocations.within.Location="3",
Number.of.sample.times.Before=1,
Number.of.sample.times.After=1,
Number.of.subtimes.within.Time=1,
Number.of.trials=NA,
Number.of.replicate.measurements=1),
effect.info=list(
Multiplicative=1,
Fixed.change=0,
Effect.values="0;-0.2;-0.4;-0.6;-0.8"))
# now run powerScenario
require(INLA,quietly=TRUE)
scenarioParams<-powerScenario(inputData=dataComponents)
#save(list=c("scenarioParams","dataComponents"),
# file=paste("Abundance_Saved_workspace_", var.r,
# ".RData",sep=""))
post.sample <- scenarioParams$post.sample
# BACI posterior
BACI.posterior <- unlist(lapply(post.sample, FUN=function(x){
A.C <- exp(x$latent["BvAxCvIAfter._.Control:1", ])
A.I <- exp(x$latent["BvAxCvIAfter._.Impact:1", ])
B.C <- exp(x$latent["BvAxCvIBefore._.Control:1", ])
B.I <- exp(x$latent["BvAxCvIBefore._.Impact:1", ])
# is the decline at the impact site bigger than any decline at the control site
diff.C <- A.C-B.C
diff.I <- A.I-B.I
diff <- (diff.I-diff.C)/mean(B.C, B.I)
return(diff)
}))
all.BACI.posterior <- c(all.BACI.posterior,list(BACI.posterior))
# repID posterior
hyper.posterior <- lapply(post.sample, FUN=function(x){
x$hyperpar
})
all.hyper.posterior <- c(all.hyper.posterior,list(hyper.posterior))
# power analysis
dataComponents$ncores <- 1
assessPower()
}
#> Error in eval(expr, envir, enclos): object 'resp.types' not foundCreated on 2024-04-23 with reprex v2.1.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels