Hi, I am trying to run a generalized gamma model via log-likelihood. I think that the code is correct, but the following error message appears: could not find feasible values. Could you see what is wrong here? $y is health care spending and $xs includes age, sex, and diagnoses.
My codes is as follows:
/*Generalised Gamma*/
*Input log-likelihood
program gglog
args lnf mu sigma kappa
local y "$ML_y1"
quietly {
replace `lnf' = ln(abs(`kappa')) - ln(`sigma') - ln(`y') - lngamma(`kappa'^-2) + ln(((`y'/exp(`mu'))^(`kappa'/`sigma'))/`kappa'^2)/`kappa'^2 - ((`y'/exp(`mu'))^(`kappa'/`sigma'))/`kappa'^2
}
end
*Estimate Generalised Gamma
capture noisily ml model lf gglog (mu: $y = $xs) /sigma /kappa, technique(nr 50 bfgs 50 dfp 50 bhhh 50)
capture noisily ml search
capture noisily ml max
Here is the results.
. capture noisily ml model lf gglog (mu: $y = $xs) /sigma /kappa, technique(nr > 50 bfgs 50 dfp 50 bhhh 50)
. capture noisily ml search
initial: log likelihood = -<inf> (could not be evaluated) could not find feasible values
. capture noisily ml max initial: log likelihood = -<inf> (could not be evaluated) could not find feasible values
Thank you in advance!
My codes is as follows:
/*Generalised Gamma*/
*Input log-likelihood
program gglog
args lnf mu sigma kappa
local y "$ML_y1"
quietly {
replace `lnf' = ln(abs(`kappa')) - ln(`sigma') - ln(`y') - lngamma(`kappa'^-2) + ln(((`y'/exp(`mu'))^(`kappa'/`sigma'))/`kappa'^2)/`kappa'^2 - ((`y'/exp(`mu'))^(`kappa'/`sigma'))/`kappa'^2
}
end
*Estimate Generalised Gamma
capture noisily ml model lf gglog (mu: $y = $xs) /sigma /kappa, technique(nr 50 bfgs 50 dfp 50 bhhh 50)
capture noisily ml search
capture noisily ml max
Here is the results.
. capture noisily ml model lf gglog (mu: $y = $xs) /sigma /kappa, technique(nr > 50 bfgs 50 dfp 50 bhhh 50)
. capture noisily ml search
initial: log likelihood = -<inf> (could not be evaluated) could not find feasible values
. capture noisily ml max initial: log likelihood = -<inf> (could not be evaluated) could not find feasible values
Thank you in advance!
Comment