You can use the stan_run() function; just cut and paste this:
stan_run <- function(stanModel, ...) {
if(class(stanModel) == "stanfit") {
stanExe <- stanModel
} else {
stanModel.rda <- gsub("stan$", "rda", stanModel)
if(!file.exists(stanModel.rda) || file.info(stanModel.rda)$mtime < file.info(stanModel)$mtime) {
cat("Model",stanModel,"needs recompilation.\n")
args <- modifyList(list(...), list(file=stanModel, iter=0, warmup=0, chains=0))
stanExe <- do.call(stan, args)
saveRDS(stanExe, file=stanModel.rda)
} else {
cat("Loading cached stan model", stanModel, ".\n")
stanExe = readRDS(stanModel.rda)
}
}
# This bit with the seed is for debugging purposes; once we figure out why Stan is crashing R we can remove it.
seed <- sample.int(.Machine$integer.max, 1)
write (paste (stanModel, seed), file="stan_seed.txt")
stan(fit=stanExe, seed=seed, ...)
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/D3p1FTu3U1M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
I can (and have) crashed the R terminal using Stan. I don’t know if I can crash the Mac unix terminal using Stan.
while true; do
R --quiet --no-save --file=crash.R || break
done
>>>>>> email to stan-users+unsubscribe@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
>>>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/D3p1FTu3U1M/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.