Closed JoseCansec closed 1 year ago
Hi, Difficult to say without seeing the data, but I suspect the issue is in the contents of Hour. unique(Hour) should contain the integers 1,2,3,4,... etc
The data consists consists of acoustic data (NASC) per cell and time lapse (hour, day, week). I have the time variables data with 1.... n as integers and the codes work when working with days and weeks either for presence absence or for conditional density. It works when fitting the model with hours as a random effect for the presence-absence of one data set but fails for conditional density. In the other data set, it fails on both presence-absence and conditional density. Could it be that the data set is too big and my computer doesn´t have the capacity?
The errors are unrelated to the size of the data.
What precisely did you mean by "sometimes", for the spareMatrix
error?
I also notice the family="gaussian"
, despite setting family="gamma"
in the bru()
call.
Are you able to share the data and code via email? Or generate a small synthetic data set of the same structure that you can share, with the code that generates the warnings/errors?
But first, make sure to let me know what inlabru version you're running, and if possible, also check if you get the warnings/errors when using the current devel
version from github.
I apologize for not having responded but I had to work on another project during this time. Regarding the spareMatrix error, it appears when defining my temporal variable as it is in my data frame without applying this:
ss_commercial2.3$Hour <- ss_commercial2.3$hour - min(ss_commercial2.3$hour) + 1
So the temporal structure is set as follows:
Hour <- ss_commercial2.3$hour nhour <- length(unique(ss_commercial2.3$hour))
I can share the code and data, just let me know what email to send it.
Best regards, Jose
If you have hourly data, so that the model should be build on an hourly basis, then the Hour
values should start at 1, and nhour should be max(ss_commercoal2.3$Hour)
(note the uppercase Hour).
You can send the code that has the problem to finn.lindgren@gmail.com
I couldn't tell from my email collection if we had solved this, but since the package code has changed considerably, it would need to be re-reported if it's still an issue with it.
I have been trying to fit a spatio-temporal model using bru. I am observing which temporal autocorrelation best explains the data and I have tried weeks, days (they both work fine) but hours gives me two errors. Heres my code and the error:
ss_commercial2.3$Hour <- ss_commercial2.3$hour - min(ss_commercial2.3$hour) + 1 Hour <- ss_commercial2.3$Hour nhour <- length(unique(ss_commercial2.3$Hour))
---------------------------------------------------------
---- Spatio-temporal model by hour---
cmp.krill.cd.h = PRC_NASC ~ Intercept+ myspde(map = coordinates, group=Hour, ngroup=nhour, model = Hosts.spde, mesh = mesh.not.com, control.group=list(model="ar1"))
------------- Model fitting
bru.krill.cd.h = bru(cmp.krill.cd.h,
family = "gamma", data= ss_commercial2.3)
The warning I get is this one:
Warning in (function (formula, family = "gaussian", contrasts = NULL, data, : f(myspde, ...): Number of unused groups >= the number of groups used: 488 >= 1, this is usually a misspesification
Additionally, sometimes I get the following error:
Error in sparseMatrix(i = i, j = (1L + A.loc@j + n.spde * (group.i - 1L) + : all(dims >= dims.min) is not TRUE
Please help!