DTUAqua / spict

Stochastic surplus Production model in Continuous Time
26 stars 18 forks source link

ERROR - Fitting issue #91

Closed Kimangie closed 4 years ago

Kimangie commented 4 years ago

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?

tokami commented 4 years ago

Hi @Kimangie,

sorry that you get this error. iqgamma is a prior which was removed from the package in commit (83de3f0). I can imagine that there is an old copy of the inp list in your R environment, which is being used when running fit.spict(inp). What do is the output of inp$priors? Is iqgamma part of the results? Did you try to restart your R? This might delete the copy of the old inp list...

Kimangie commented 4 years ago

Thank you @tokami. I tried yes, and still this ERROR.. Look at the output: (can not see iqgamma..)

inp$priors $logn [1] 0.6931472 2.0000000 1.0000000 $logalpha [1] 0 2 1 $logbeta [1] 0 2 1 $logr [1] -9.21034 0.20000 0.00000 $logK [1] -9.21034 0.20000 0.00000 $logm [1] -9.21034 0.20000 0.00000 $logq $logq[[1]] [1] -9.21034 0.20000 0.00000 $logqf [1] -9.21034 0.20000 0.00000 $logbkfrac [1] -9.21034 0.20000 0.00000 $logB [1] -9.21034 0.20000 0.00000 2000.00000 0.00000 $logF [1] -9.21034 0.20000 0.00000 2000.00000 0.00000 $logBBmsy [1] -9.21034 0.20000 0.00000 2000.00000 0.00000 $logFFmsy [1] -9.21034 0.20000 0.00000 2000.00000 0.00000 $logsdb [1] -9.21034 0.20000 0.00000 $logsdf [1] -9.21034 0.20000 0.00000 $logsdi $logsdi[[1]] [1] -9.21034 0.20000 0.00000 $logsde [1] -9.21034 0.20000 0.00000 $logsdc [1] -9.21034 0.20000 0.00000 $logsdm [1] -9.21034 0.20000 0.00000 $logpsi [1] -9.21034 0.20000 0.00000 $mu [1] -9.21034 0.20000 0.00000 $BmsyB0 [1] -9.21034 0.20000 0.00000 $logngamma [1] -9.21034 0.20000 0.00000

tokami commented 4 years ago

After restarting R and loading spict require(spict), can you please run sessionInfo() and post the results here?

Kimangie commented 4 years ago

Yes sure,

library(spict) Le chargement a nécessité le package : TMB Welcome to spict_v1.2.8@ca04322e9438604035be73aa55ecb8ddc146c360 sessionInfo() R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 [4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] spict_1.2.8 TMB_1.7.15 loaded via a namespace (and not attached): [1] compiler_3.6.2 Matrix_1.2-18 tools_3.6.2 yaml_2.2.0 grid_3.6.2 lattice_0.20-38

alko989 commented 4 years ago

@Kimangie probably not the case but just to be sure: some R editors, like Rstudio are saving all the variables before exiting and loading them back on startup. Can you manually remove all variables with rm(list = ls())and try your code again?

Kimangie commented 4 years ago

@alko989 yep I also tried this... I will try as a last option what @tokami suggested me.. change the inp name. Thank you all, I am desesparate at this point, should run 2 models to give ICES advices tomorrow! Not the right timing...

Kimangie commented 4 years ago

@tokami Just tried to change name and same ERROR!! Getting nuts :( See:

dd <- list(obsC=sepia.7de$C.obs, timeC=sepia.7de$Year, obsI=sepia.7de$AI.obs, timeI=sepia.7de$Year) inp0a <- check.inp(dd) inp0a$dtc [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 out0a <-fit.spict(inp0a) 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.

tokami commented 4 years ago

if it sill doesn't work, you can try to install the package version before the commits changing the priors, e.g. devtools::install_github("DTUAqua/spict/spict", ref="5ae1381109890c740090b9db2392afe6b11444b0")

alko989 commented 4 years ago

@Kimangie I am sorry you are having such troubles.

Does test.spict() also have the same error? Probably. Then it should be a problem with the spict installation, try removing spict with remove.packages("spict") and install again.

As a temporary solution, you can try installing an older version of spict, e.g. remotes::install_github("DTUAqua/spict/spict", ref = "5ae1381109890")

Kimangie commented 4 years ago

Ok thanks, will definitely try this as I can not understand what is going on... Hope it will help to fix it, otherwise .. Nobody had tis trouble when running SPiCT 1.2.8 ..? so weird!

De: "Tobias Mildenberger" notifications@github.com À: "DTUAqua/spict" spict@noreply.github.com Cc: "Angela Larivain" angela.larivain@unicaen.fr, "Mention" mention@noreply.github.com Envoyé: Mardi 14 Janvier 2020 11:06:08 Objet: Re: [DTUAqua/spict] ERROR - Fitting issue (#91)

if it sill doesn't work, you can try to install the package version before the commits changing the priors, e.g. devtools::install_github("DTUAqua/spict/spict", ref="5ae1381109890c740090b9db2392afe6b11444b0")

— You are receiving this because you were mentioned. Reply to this email directly, [ https://github.com/DTUAqua/spict/issues/91?email_source=notifications&email_token=AOHYVWX5QTQXTXDIYPBYUSLQ5WFBBA5CNFSM4KFJVS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI4AZHY#issuecomment-574098591 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AOHYVWS2A2PVIOBIUMROAULQ5WFBBANCNFSM4KFJVS5A | unsubscribe ] .

Kimangie commented 4 years ago

Do I have any informatique issues, I mean is it me or my computer cause now SPiCT is removed, I have this error when trying to install back .. Error: Failed to install 'unknown package' from GitHub: Timeout was reached: [api.github.com] Connection timed out after 10010 milliseconds

I shoud ask for an informatique course haha

De: "Alexandros Kokkalis" notifications@github.com À: "DTUAqua/spict" spict@noreply.github.com Cc: "Angela Larivain" angela.larivain@unicaen.fr, "Mention" mention@noreply.github.com Envoyé: Mardi 14 Janvier 2020 11:06:26 Objet: Re: [DTUAqua/spict] ERROR - Fitting issue (#91)

[ https://github.com/Kimangie | @Kimangie ] I am sorry you are having such troubles.

Does test.spict() also have the same error? Probably. Then it should be a problem with the spict installation, try removing spict with remove.packages("spict") and install again.

As a temporary solution, you can try installing an older version of spict, e.g. remotes::install_github("DTUAqua/spict/spict", ref = "5ae1381109890")

— You are receiving this because you were mentioned. Reply to this email directly, [ https://github.com/DTUAqua/spict/issues/91?email_source=notifications&email_token=AOHYVWUZXFKNGKYC6GYUYM3Q5WFCDA5CNFSM4KFJVS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI4A2HA#issuecomment-574098716 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AOHYVWSRCEZUWDQRRSHP72TQ5WFCDANCNFSM4KFJVS5A | unsubscribe ] .

Kimangie commented 4 years ago

When installation is done, I have warnings: Warning messages: 1: In untar2(tarfile, files, list, exdir) : skipping pax global extended headers 2: In untar2(tarfile, files, list, exdir) : skipping pax global extended headers Is it the prblem from?

De: "Alexandros Kokkalis" notifications@github.com À: "DTUAqua/spict" spict@noreply.github.com Cc: "Angela Larivain" angela.larivain@unicaen.fr, "Mention" mention@noreply.github.com Envoyé: Mardi 14 Janvier 2020 11:06:26 Objet: Re: [DTUAqua/spict] ERROR - Fitting issue (#91)

[ https://github.com/Kimangie | @Kimangie ] I am sorry you are having such troubles.

Does test.spict() also have the same error? Probably. Then it should be a problem with the spict installation, try removing spict with remove.packages("spict") and install again.

As a temporary solution, you can try installing an older version of spict, e.g. remotes::install_github("DTUAqua/spict/spict", ref = "5ae1381109890")

— You are receiving this because you were mentioned. Reply to this email directly, [ https://github.com/DTUAqua/spict/issues/91?email_source=notifications&email_token=AOHYVWUZXFKNGKYC6GYUYM3Q5WFCDA5CNFSM4KFJVS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI4A2HA#issuecomment-574098716 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AOHYVWSRCEZUWDQRRSHP72TQ5WFCDANCNFSM4KFJVS5A | unsubscribe ] .

Kimangie commented 4 years ago

Ok thank you so much everyone, it seems it runs with SPiCT 1.2.7 (tried data pol exercie and no ERROR when fitting) so for now I will work with this version but I really need to fix for next time! Also hope the warnings are not too anoying.. Huge Thank!

tokami commented 4 years ago

The untar error is weird. What is your Rtools version (3.5)? Maybe try updating Rtools?!