Issue with variable names staying when using as_draws_df

Hi,

I am having an issue using the function as_draws_df from the posterior package on my institute’s HPC, where the output draws_df output does not contain the variable names.

I have used this function successfully in the past, and it currently works fine on my local machine. It has worked fine on my institute’s HPC before, but it is now giving me an issue. I am running a fixed parameter model (fixed_param=TRUE, so only one draw is produced). My fit$draws looks like the following:

> fit$draws()
# A draws_array: 1 iterations, 1 chains, and 23548 variables
, , variable = Y[1,1]

         chain
iteration   1
        1 -85

, , variable = Y[2,1]

         chain
iteration   1
        1 -83

, , variable = Y[3,1]

         chain
iteration   1
        1 -81

Normally when I use the as_draws_df() function, the result is of the form

>as_draws_df(fit$draws())
# A draws_df: 1 iterations, 1 chains, and 94171 variables
  Y[1,1] Y[2,1] Y[3,1] Y[4,1] Y[5,1] Y[6,1] Y[7,1] Y[8,1]
1    -83    -81    -78    -76    -74    -72    -69    -67
# ... with 94163 more variables
# ... hidden reserved variables {'.chain', '.iteration', '.draw'}

(not the same fit)

However, I am currently getting the following result

> as_draws_df(fit$draws())
# A draws_df: 1 iterations, 1 chains, and 1 variables
   value
1    -85
2    -83
3    -81
4    -79
5    -77
6    -75
7    -74
8    -72
9    -70
10   -68
# ... with 23538 more draws
# ... hidden reserved variables {'.chain', '.iteration', '.draw'}

Values are slightly different (getting one version from my HPC and one from my computer with different inputs).

There is a version difference, the version on my HPC is v1.0.1, and on my machine is v0.1.2. However, it is my understanding that the output should contain the variable names. I have made other functions that rely on the output of as_draws_df to be in the proper format.

Is this an issue with v1.0.1?
Any suggestions?

A related issue (as_draws_list.draws_rvars looses variable names if there is just a single draw · Issue #186 · stan-dev/posterior · GitHub) has been fixed in github. Can you try whether the github version solves your problem, too?

remotes::install_github("stan-dev/posterior")
1 Like