On Fri, 28 Jan 2011, GREg Ory wrote: > Dear Gretl community, > > I need some tips on estimating panel data using nonlinear switching > regression technique.
Is this what you have in mind? <script> set echo off set messages off function series GDV(series x, scalar m, scalar s) series den = exp(pi*(m-x)/(s*sqrt(3))) return 1/(1+den) end function # open the dataset open gretl_plant.gdt #rescale stuff a little to avoid numerical problems Price /=100 HHI *= 100 Domestic_Sales /= 10000 Export_Sales /= 10000 Total_import /= 10000 # initialisation scalar m = mean(HHI) scalar s = sd(HHI) series Log = GDV(HHI, m, s) series e = (Price - Log) list X = const Domestic_Sales Export_Sales Soda PCFT Total_import ols e X -q b = $coeff # do NLS nls Price = lincomb(X,b) + Log series Log = GDV(HHI, m, s) params b m s end nls -q # print out results with some nice formatting matrix cf = b | {m; s} matrix se = sqrt(diag($vcv)) vnam = varname(X) ~ ",mu,sigma" cfse = cf ~ se modprint cfse vnam </script> HTH, Riccardo (Jack) Lucchetti Dipartimento di Economia Università Politecnica delle Marche r.lucchetti(a)univpm.it http://www.econ.univpm.it/lucchetti