Thanks Dan for your answer
I realized that maybe I was not clear between get.real function on the model results and predict.oSCR !
What I did on the following model :
model0wide <- oSCR.fit(model = #model formulation
list(D ~ 1, p0 ~ 1, sig ~ 1), scrFrame = sf, ssDF = data.ss, trimS=10000)
1 - make predictions on the real scale
pred.df.dens <-data.frame(Session =factor(1))
#make predictions on the real scale
(pred.dens <-get.real(model0wide,type ="dens",newdata =pred.df.dens, d.factor=d.factor))
and
2 - the predict function
pred <- predict.oSCR(model0wide, sf, data.ss, override.trim=TRUE)
And it works well,
Then I added a covariate to the density on a new 'model' oSCR.fit(model = list(D ~ elev, p0 ~ 1, sig ~ 1), scrFrame = sf,
ssDF = s_space, trimS = 15000)
I can run the predict.oSCR function and get for instance the prob for each indiv accross the study site (from pred$preds[[1]] )
I also run the get.real function on sigma or detection, it works well as I do not have covariates
For density :
I have one value of elevation (elev) for each cell of the statespace.
# Build the prediction matrix accross statespace cells
pred.df.dens <- data.frame(Session = factor(1), elev = s_space[[1]]$elev)
=> the dataframe has twice more lines ( male + female) than the number of cells in the statespace. = 2 x 100 000 rows
#make predictions on the real scale
pred.dens <- get.real(model, type = "dens",
newdata = pred.df.dens,
d.factor = d.factor)
I obtain a table of 200 000 rows with a density per sex per pixel while when using the same code with the previous model I got total of male and total of female.
Hope this is more clear,
Have a nice week end
Gilles