I wish to model effects of different predictors on different parameters of a logistic distribution
y=asym/(1+exp((midy-time)/halft))
I want the asym parameter to have the lognormal distribution, the midy parameter to have a normal distribution and the halft parameter to be lognormal (to constrain asym and halft to be positive). I want to allow random intercepts for each parameter
So, I tried defining the brms formula, thus:
bflog=nlf(asym~x1+(1|g)+lognormal()) + nlf(midy~x2+(1|g)) + nlf(halft~x3+(1|g)+lognormal()) + nlf(y~asym/(1+exp((midy-xt)/halft))) + set_nl(TRUE)
But this gives the error:
Error in nlf(asym ~ x1 + (1 | g) + lognormal()) + nlf(midy ~ x2 + (1 | :
non-numeric argument to binary operator
Each component is, by itself, OK. So, R accepts the following code without error.
f1=nlf(asym~x1+(1|g)+lognormal())
f2=nlf(midy~x2+(1|g))
f3=nlf(halft~x3+(1|g)+lognormal())
f4=nlf(y~asym/(1+exp((midy-xt)/halft)))
But, bflog=f1+f2+f3+f4 gives the same error as before:-
Error in f1 + f2 : non-numeric argument to binary operator
I’d be very grateful for guidance on how to construct the non-linear formula
Well, I can create a toy data-set. But, the problem lies in the creation of the formula - which does not involve the data. So, I get the same error with or without data present in the environment. Here is a toy example:-