dtuaqua / spict Goto Github PK
View Code? Open in Web Editor NEWStochastic surplus Production model in Continuous Time
Stochastic surplus Production model in Continuous Time
I just have a couple of suggestions for the function plot(fit)
Bottom-center panel: neither label tells me what biological pattern this is. Is it the seasonal production curve? As a novice user, I'm trying to check if the timing is right (Jan-Jan) based on my biological knowledge of the stock.
Center top and middle panel: both contain Ft/Fmsy. This seems like a waste of space/ink
It would be helpful to have example data sets with seasonal data, effort data, regime shifts, and time varying growth.
retro() function does not work with effort index
between lines 19 and 20 in the retro() code we need the code
inpall[[i]]$dte <- inp1$dte[indsE]
Function fit.spict()
does not return result regarding likelihood profiles (likprof). The latter is needed from function likprof.spict()
.
I've just updated my SPiCT version to the 1.2.8 and now my script is not working anymore.
When trying the line to fit (fit.spict) I obtained:
res <- fit.spict(inp)
Error in TMB::MakeADFun(data = datin, parameters = pl, random = inp$RE, :
Error when reading the variable: 'prioriqgamma'. Please check data and parameters.
In addition: Warning message:
In TMB::MakeADFun(data = datin, parameters = pl, random = inp$RE, :
Expected object. Got NULL.
Any idea please?
https://github.com/mawp/spict/blob/befb52bb91daafa73a397d4f87c147d7323194e9/spict/src/spict.cpp#L27
Assuming:
B0 = 1/2
K = 1
m = 1/2
F = 0
dt = 1/2
sdb = 0
n = 2
gamma = n^(n/(n-1)) / (n-1) = 4
The function on line 27 evaluates to: -0.1931472 for log biomass 1/2 a time unit later.
The Fletcher form is here
dB/dt = gamma * m * B/K - gamma * m * (B/K)^n
= 2 * B - 2 * B^2
analytically integrates to
B(t) = exp(2 * t) / (c + exp(2 * t))
where
c = 1 / B0 - 1 = 1
For t = 1/2
B(1/2) = exp(1) / (1 + exp(1)) = 0.7310586
and
log(B(1/2)) = log(0.7310586) = -0.3132617
which differs from the function provided.
I am trying to install from github using
devtools::install_github("mawp/spict", subdir="spict")
using both CRAN's or github's version of TMB. I am getting messages about no matching call for ceil(). among others (see attached file)
install.txt
Trued with both gcc 4.8.4 (Ubuntu 14.04) and 4.9.2 (Ubuntu 16.04). Windows users with gcc 4.6.3 in Rtools appear to be able to compile it.
fractile for predicted catch distribution has to be saved with associated fitted spict object
Setting the upper limit of ylim
in plotspict.ffmsy
does not work. This might be useful to zoom out in case of large uncertainty.
second scenario (in redin blue)
Also state that the black line is the base fit and the grey area the 95% CI of the base fit.
The line in the pred.catch function:
Flast <- get.par('logF', repin, exp=TRUE)[repin$inp$indpred[1], 2]
does not correct for seasonality. It should say:
Flast <- get.par('logFnotS', repin, exp=TRUE)[repin$inp$indpred[1], 2]
As it is now only one alpha prior is set for all indices.
Hi there,
I had my computer back from new installation of windows10 software..
Since, no way I can install SPiCT with devtools or remotes command, nor with the unzipped folder...
I always have or an issue like this:
remotes::install_github("DTUAqua/spict/spict", ref = "5ae1381109890")
Erreur : Failed to install 'unknown package' from GitHub:
Timeout was reached: [api.github.com] Connection timed out after 10001 milliseconds
OR:
setwd("C:/Users/larivain/Desktop/spict-master")
source("install_windows.R")
Warning message:
In shell("make install") :
l'exécution de 'make install' a échoué avec le code d'erreur 2
Any idea please?
I have TMB and Rtools updated!
Thank you ..
... if they are set after check.inp
.
This produces the wrong result:
library(spict)
inp <- pol$albacore
inp <- check.inp(inp)
inp$priors$logbkfrac <- c(log(1), 0.3, 1)
fit <- fit.spict(inp)
sumspict.priors(fit)
# mean std
# logn 0.6931472 2.0
# logalpha 0.0000000 2.0
# logbeta 0.0000000 2.0
# logbkfrac -9.2103404 0.2
Whereas this works as it should:
library(spict)
inp <- pol$albacore
inp$priors$logbkfrac <- c(log(1), 0.3, 1)
inp <- check.inp(inp)
fit <- fit.spict(inp)
sumspict.priors(fit)
# mean std
# logbkfrac 0.0000000 0.3
# logn 0.6931472 2.0
# logalpha 0.0000000 2.0
# logbeta 0.0000000 2.0
Hi again,
Now back to 1.2.7 version I am able to fit a 'simple case', which is a list with catch and one indice (thank you!)
BUT again a MakeADFun error (different this time) when trying what was working before in previous version of SPiCT, when inputing a list of indices (for example I am trying to fit a model for english channel's cuttlefish with LPUE series from french commercial boats & 2 LPUE series from UK, in october and november...).
Please have a look and if you can tell me how to fix it (or I definitely have an issue with the package):
fit.7de <- fit.spict(res.7de)
Error in TMB::MakeADFun(data = datin, parameters = pl, random = inp$RE, :
Error when reading the variable: 'robflagi'. Please check data and parameters.
In addition: Warning message:
In TMB::MakeADFun(data = datin, parameters = pl, random = inp$RE, :
Expected scalar. Got length=3
When checking all in your page, I found somathing about robust options:
res.7de$robflagi
[1] 0 0 0
Many thks
If a plotspict.* has a stamp the plotting of extra points/lines should be done as expected.
When spict is installed from github using devtools, the GithubSHA1 in the DESCRIPTION is updated and shows the actual commit of the installed version.
For local installations with the Makefile, the GithubSHA1 that is in the DESCRIPTION file is the one from the one-before-last commit.
Possible solution
In get.version
there should be a check if the installation is local/github/CRAN and show the version using:
git describe HEAD --tags | rev | sed 's/g-/./' | sed 's/-/+/' | rev
As described in WKMSYcat34 equation 3.1.2.
Hello. I'm trying to build management scenarious for forecast following next approach:
data <- read.csv("input/data.csv")
# build data object to spict format
inp <- data %>%
add_column(timeI = data$year) %>%
rename(timeC = year, obsI = cpue, obsC = c) %>%
as.list(.)
inp$robflagc = 1 # reduce extreme catch variations as noted in vignette
inp <- check.inp(inp)
fit <- fit.spict(inp)
mng <- manage(fit)
and this code throw an error:
Error in optimHess(par.fixed, obj$fn, obj$gr) :
gradient in optim evaluated to length 1 not 10
The error happens only if robflagc=1
sets. Hope you have a time to fix it in future.
Hi,
I have an error:
need finite 'ylim' values
when I try to do a plot with plotspict.retro() function.
My code:
# Retrospective Plots
output$retro<- renderPlot({
# Take dependency on action button
if(input$runspict == 0) return()
isolate({
rep <- spict()
retros <- retro(rep)
if(!is.null(retros)){
plotspict.retro(retros)
}
})
})
Look forward for some tips.
Cheers !
George
When multiple indices are used the plotspict.osar
plots all indices but has title "Index 1 Bias p-val: x.xxx".
It should be "Index Bias p-val: x.xxx, y.yyy, z.zzz" with red/green colored values.
Maybe when called by plot.spictcls
it should not have the info on bias.
As it is it causes an error while checking for CRAN
Affected functions: plot, summary, retro, manage (probably others too)
Culprits are (at least) the logFnotS and Fest
Makefile should update version number in "make.description.R".
When a user scales the uncertainty of different time series, check.inp
should check if stddevfac*
vectors have mean of 1 and if not scale them (with a warning).
Set getReportCovariance to FALSE by default in retro
Correct me if I am wrong, but I don't think it is possible to fix one of the catchability coefficients if e.g. an absolute survey is available. It is not possible to provide a vector for the inp$phases
, it is either estimate all or none, isn't it?
In the cpp code seasontype
is of class Type
, should be integer.
The results of check.ini
should be directly easy to interpret.
One option is only to show the data.frame
with the converged estimates so the user can directly see if there are differences.
Or it should return TRUE
if the estimates are almost equal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.