> 1) the "restrict" command already handlòes nonlinear restrictions, so I 
don't quite understand the purpose of your function
As it happens, it's for my training in hansl 

Dear Riccardo,
Do you have any comments for ADF-GLS pre-package?
I send a new variant with better GUI
Also, could you make working extractors $coeff,  $sigma, and $df
for gretl "adf" command, or it would be better if I make
duplicated version of lag length selection for ERS' 
modified PT test? 
Oleh


--- Оригінальне повідомлення ---
Від кого: "Riccardo (Jack) Lucchetti" <r.lucchetti@univpm.it>
Дата: 14 квітня 2015, 09:43:51

On Tue, 14 Apr 2015, oleg_komashko@ukr.net wrote:

> Thank you!
> Here is the simple function to perform Wald test for nonlinear restrictions in an ols model (the question is below)
> # powers to pass to fdjac  p(x) is x   p(x,3) is x^3
> function scalar p(scalar x, scalar p[1])     return x^p end function
>
> function matrix fun4(strings fun, matrix rhs, matrix beta, matrix vcov, scalar s, scalar df)     b = beta     coll = rows(b)     r = nelem(fun)     matrix matr = zeros(r,coll)     matrix matr2 = zeros(r,1)     loop i=1..r --quiet         fu = fun[i]         vect = fdjac(b,@fu)         matr[i,] = vect         matr2[i,] = @fu-rhs[i]     endloop     ret = matr*vcov*transp(matr)     reti = inv(ret)     ff = transp(matr2)*reti*matr2/r     pval = 1-cdf(F,r,df,ff)     out = {ff,pval}     colnames(out, "F p-value")
>     return out
> end function
> ## examples of restrictions matrix rhs = {0,0,0} strings S = array(2)
> S[1] = "p(b[2])+p(b[3])" S[2] = "p(b[2])+2*p(b[3])"
> strings S1 = array(1)
> S1[1] = "p(b[2])+p(b[3])"
> open denmark.gdt
> ols LRM const LRY IBO
>
> eval fun4(S1,rhs,$coeff,$vcv,$sigma,$df)
> eval fun4(S,rhs,$coeff,$vcv,$sigma.$df)
> Is there any way to make $coeff,$vcv,$sigma,$df the defaults so that the call be fun4(S1,rhs)?
>

Oleh,

not a direct answer to your question, but two remarks:

1) the "restrict" command already handlòes nonlinear restrictions, so I 
don't quite understand the purpose of your function

2) when you include code, be sure to add linebreaks where appropriate, 
otherwise it's a bit difficult reading them. I thought it was my mail 
client, but in fact if you look at some of your messages through a 
browser from the mailing list archive, you get the same effect. See for 
example here: 
http://lists.wfu.edu/pipermail/gretl-users/2015-April/010845.html



-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti@univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users