Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: How to maximize an approximated likelihood
From
Feddag Mohand-Larbi <[email protected]>
To
[email protected]
Subject
st: How to maximize an approximated likelihood
Date
Mon, 08 Apr 2013 10:04:56 +0200
Dear Statausers,
I am wondering to know how to maximize an approximated likelihood
depending on three parameters: the difficulty parameter as matrix, the
mean of the latent traits and its variance.
The function wrotten in Stata where the approximation is obtained by
Gauss-Hermite quadrature is given as follows:
qui gen proba=.
qui gen x=.
forvalues i=1/`nbobs' {
local int2=1
local u=RaschDepLoc[`i',1]
local v=`diff'[1,1]
local int1 "exp(`u'*(x-`v'))/(1+exp(x-`v'))"
forvalues j=2/`nbitems' {
local t=`diff'[`j',1]
local r=RaschDepLoc[`i',`=`j-1'']
local s=RaschDepLoc[`i',`j']
local int2
"`int2'*exp(`s'*(x-`t'+`d'*`r'))/(1+exp(x-`t'+`d'*`r'))"
}
local int="`int1'*`int2'"
qui gausshermite `int', mu(`mu') sigma(`sigma') display
qui replace proba=r(int) in `i'
}
gen lik=log(proba)*`nbobs'
where nbobs is the number of individuals, nbitems is the number of
items, RaschDepLoc is the matrix of data of order (nbobs*nbitems), diff
is the vector of difficulties parameters, mu and sigma^2 are the mean
and the variance of the latent traits.
I don't know how to write this function in order to use ml model lf myfunction (? =?)
and ml maximize
best
Dr Feddag
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/