fate-ewi / bayesdfa

Bayesian DFA with Stan
28 stars 13 forks source link

Models with unequal variance-covariance observation error matrix with several long time series #10

Open Giapass opened 4 years ago

Giapass commented 4 years ago

Hi, I am trying to fit a dfa model for 55 time series using 3 trends. I had no issues when considering an observation error matrix with diagonal and equal variance-covariance.

https://github.com/Giapass/Landings/blob/master/dat.csv

fit<-fit_dfa(y = dat, num_trends = 3, zscore = FALSE,iter = 1000, varIndx = rep(1,55), chains = 4, thin = 1, control = list(adapt_delta =0.99, max_treedepth = 15), estimate_nu = FALSE, est_correlation = FALSE)

However, when specifing a model with diagonal and unequal variance-covariance matrix
fit<-fit_dfa(y = dat, num_trends = 3, zscore = FALSE,iter = 1000, varIndx = c(1:55), chains = 4, thin = 1, control = list(adapt_delta =0.99, max_treedepth = 15), estimate_nu = FALSE, est_correlation = FALSE)

The chains did'nt initialized and these kind of errors are repeated hundred times:

SAMPLING FOR MODEL 'dfa' NOW (CHAIN 1). Chain 1: Rejecting initial value: Chain 1: Log probability evaluates to log(0), i.e. negative infinity. Chain 1: Initialization between (-2, 2) failed after 100 attempts. Chain 1: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model. [1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed." [1] ``` "error occurred during calling the sampler; sampling not done" Stan model 'dfa' does not contain samples. Stan model 'dfa' does not contain samples. Stan model 'dfa' does not contain samples. Error in names(object) <- nm : 'names' attribute [1] must be the same length as the vector [0]


I know that is not a problem with the data because, using only 40 series, the model runs but as far as I include one serie more (not matter which serie) it stop working. 
Not sure where is the problem for bayesdfa as for the library 'atsar' (I suppose the previous package) the same parameters for initialization works.

I will appreciate so much your help to solve this issue.
Regards

Giannina Passuni