On Fri, 28 Jan 2011, GREg Ory wrote:
I need some tips on estimating panel data using nonlinear switching
regression technique. AFAIK there are two ways of solving it.
The model I estimate is the following:
panel Price const Cost logist Domestic_Sales Export_Sales Soda PCFT Total_import
Logistic function is given as logist = 1/(1+exp(1,81*(mu-HHI)/sig)).
If I understand the problem correctly you should probably be able
to do this via nls, though you'd have to create the fixed-effects
dummies and enter them yourself ("genr unitdum"). However, if you
take the grid-search approach for mu and sigma then something like
the following should work:
<script>
open gretl_plant.gdt
scalar R2max = 0
scalar optmu
scalar optsig
scalar nvals = 0
loop for (mu=0.28; mu<0.501; mu+=.01) --quiet
loop for (sig=0.01; sig<0.201; sig+=.01) --quiet
series logist = 1/(1+exp((mu-HHI)/sig))
panel Price const Cost logist Domestic_Sales Export_Sales \
Soda PCFT Total_import --quiet
r2 = $rsq
if r2 > R2max
optmu = mu
optsig = sig
R2max = r2
endif
nvals++
endloop
endloop
printf "Number of points checked = %d\n", nvals
printf "R^2 is maximized at %.4f for mu = %g, sig = %g\n",
R2max, optmu, optsig
series logist = 1/(1+exp((optmu-HHI)/optsig))
panel Price const Cost logist Domestic_Sales Export_Sales \
Soda PCFT Total_import
</script>
Allin Cottrell