I am currently trying to optimize a model which may have multiple local minimum and variants.
I am using ordinal regression and maximum likelihood with fit = sm.optimizing(data=data, init=init, algorithm=‘BFGS’).
I am planning to run the model for a few times and try to output a maximum likelihood value that I can compare each time and choose the result that has the best maximum likelihood value. But I dont know how to output that value.
Can someone please kindly help me?
Thank you very much.
It’s in the fit object that’s return from
optimizing. Here’s the doc from R for
The point estimate found. Its form (vector or list) is determined by the as_vector argument.
Hi Bob, thanks a lot for the answer. But in the fit object, I only find the values for the parameters. What I mean is the predicted value of Y each that that I will use to compare with the real Y. For example y ~ normal (). So I want to know each time, what value does the ~ normal gives me.
I don’t understand what you want here. The parameter values are the maximum likelihood estimate.
If you want the predicted values of
y, it depends on your model and you’ll need to save the values as transformed parameters or generated quantities.
~ only gives you an increment to the log density. It does not do sampling from the right-hand side. You can use the RNG functions in generated quantities to simulate if that’s what you want to do.