Problem with weights in brms

#1

Please also provide the following information in addition to your question:

  • Operating System: Windows 10
  • brms Version: 2.8.0

I am trying to assign weights to my observations, using the following code:

fit<- brm(
bf(LDL|weights(weight) ~ 15 + (alpha-15) / (1 + exp ((gamma-Time) / delta)),
alpha ~ 1 + (1|Cat) + (1|Sample) ,
gamma ~ 1 + (1|Cat) + (1|Sample),
delta ~ 1,
nl = TRUE),
etc…

where ‘weight’ is a vector of the weights I want to assign to my observations, as instructed here.

However, when I try to run it, I get the following error:

Error: The following variables are missing in ‘data’:
‘weight’

I am not quite sure what the problem is.
Does anyone have any idea?

#2

apparently your data does have a column named “weight” which you passed to the weights() function. are you sure this variable is in your data set?

#3

Ah, I see what the problem was,
I assigned the column of the data set to a vector, called ‘weight’ and then passed it on to weights(), but what I should have done is put a name ‘weight’ to the column in my data set and then pass it on to weights().
Sorted now.

Thanks!