I am trying to do a relatively simple nonlinear mixed effect fit: the fitted parameter is allowed float according to a distribution with fixed mean but fitted or fixed variance. I can see two ways to do it. Frst, NLME in statistics toolbox, but I do not want to use the build-in optimizer. I have a global optimizer, but cannot see a easy way to use it with matlab NLME. Second, design my own algorithm for mixed effect fit, so that I can use my own optimizer. However I do not know how to do it. Can someone give me some idea on this? How can I fit a model with parameter constrained by a distribution? Thanks a lot!