Hello,

I have data coming from subjects (example attached) to which I would like to fit per individual as well as on a group level (hierarchical) this logit function:

I was following those posts https://discourse.mc-stan.org/t/trying-to-fit-my-costumised-logistic-function/12228/14, this solution, and https://discourse.mc-stan.org/t/difficulties-with-logistic-population-growth-model/8286/2 and bellow is my STAN code but I am having problems with initialisation.

- Could you please help me with that? Is it a prior problem? Or too much noise in the data?

```
data{
int<lower=1> N;
int<lower=1> T; // num of GS
real<lower=0, upper=1> y[N, T];
real<lower=0, upper=2> GS[N,T];
}
parameters{
// all parameters vary by subject
real<lower=0, upper=1> PSE[N]; //mid point
real steepness[N];
real inflection[N];
real<lower=0> sigma; // residual error of the observations, need to be positive
}
model{
PSE ~ normal(0.5, 1);
steepness ~ exponential(0.2); // gamma(7, 0.3)
inflection ~ gamma(7, 0.15);
for(n in 1:N)
for(t in 1:T)
y[n, t] ~ normal(PSE[n]-(1/(1+exp(-steepness[n]*(GS[n,t]-inflection[n])))), sigma);
}
```

- Another question would be, can I somehow optimise my code? I was trying to make some use of
`inv_logit`

and`binomial`

functions/distributions, the problem is that my values are not integers. What I’m trying to fit is a probability of an answer being incorrect (`y`

) given the distance (`GS`

). There is a given and fixed number of`GS`

s values per individual and I know that y=0,5 (or should) at GS=0.

Thank you for any insights.

Data:

```
GS = np.array([0. , 0.33, 0.6 , 0.8 , 1. , 1.33])
y = np.array([[0.4 , 0. , 0.2 , 0.6 , 0.2 , 0.2 ],
[0.5 , 0.5 , 0.5 , 0.6 , 0.4 , 0.25],
[0.6 , 0. , 0. , 0.2 , 0. , 0. ],
[0.2 , 0.2 , 1. , 0.6 , 0.2 , 0.2 ],
[0.6 , 0. , 0. , 0. , 0. , 0. ],
[1. , 0.6 , 0.2 , 0.4 , 0.4 , 0. ],
[0.2 , 0.4 , 0. , 0.2 , 0.2 , 0. ],
[0. , 0. , 0. , 0. , 0. , 0.4 ],
[0.8 , 0.2 , 0.8 , 0.2 , 0.4 , 0.6 ],
[0.2 , 0.2 , 0. , 0.2 , 0. , 0. ],
[0.4 , 0.2 , 0.2 , 0.2 , 0. , 0. ],
[0. , 0. , 0.4 , 0.4 , 0.2 , 0. ],
[1. , 0. , 0. , 0. , 0. , 0. ],
[0.6 , 0. , 0.4 , 0. , 0.2 , 0. ],
[0.6 , 0.6 , 0.2 , 0.2 , 0.4 , 0.6 ],
[0.8 , 0.2 , 0.2 , 0.2 , 0. , 0.4 ],
[0.8 , 0.4 , 0.2 , 0. , 0.6 , 0.2 ],
[0.4 , 0.2 , 0.2 , 0. , 0.2 , 0. ],
[0.5 , 0.2 , 0. , 0. , 0.2 , 0.2 ],
[0.5 , 0. , 0.4 , 0. , 0. , 0. ],
[0.8 , 0.4 , 0. , 0. , 0. , 0. ],
[0.2 , 0.2 , 0.2 , 0.2 , 0.2 , 0. ],
[0.4 , 0.6 , 0.6 , 0.2 , 0.6 , 0. ],
[0.2 , 0.6 , 0.4 , 0.4 , 0. , 0. ]])
```