I want to use mle to estimate theta for Inverse hyperbolic sine transformation , I have written the likelihood function as follows:
Array
Because the y in myresearch is profit ,and it has negative values.So I want to use mle to estimate the theta and some mistakes arised. it shows "= is not a valid command name" after `y'=asinh(`theta' * $ML_y) / `theta'.Here is my code:
----------------------- copy starting from the next line -----------------------
Code:
sysuse auto.dta
cap program drop mylf
program define mylf
args lnf mu sigma theta
`y'=asinh(`theta' * $ML_y) / `theta'
quietly replace `lnf' = ln(normalden((`y' - `mu')/`sigma')) - ln(`sigma') - (1/2)*ln(1+(($ML_y)^2) * ((`theta')^2))
end
reg price mpg rep78 headroom trunk
matrix b=e(b)
matrix b=b,0
ml model lf mylf ( price = mpg rep78 headroom trunk)(sigma:)(theta:)
ml check
ml init b,copy skip
ml maxI wonder if you can figure out mistakes in my code,many thanks in advance
0 Response to How can I get theta for Inverse hyperbolic sine transformation by mle?
Post a Comment