On Mon, 15 Nov 2010, Lee Adkins wrote:
Is there an accessor for restricted estimates after a restrict
statement? After ols the restricted regression runs by default,
but I can't figure out how to access the restricted estimates.
BTW, my goal here is to shrink unrestricted estimates toward the
restricted.
Right now there's no such accessor. One possibility would be to
generalize the "--full" option to restrict, which is currently
available only for VECMs. This replaces the "last model" with the
restricted estimates, so that the $coeff accessor can be used.
At present if you want to get the restricted estimates from OLS
programmatically you'd have to use gretl's string-handling
functions (which would get you the coefficients to 6 significant
digits), as in:
<script>
open data4-1
ols 1 0 2 3 4
outfile restrict.txt --write
restrict
b3 - b4 = 0
end restrict
outfile --close
string s = readfile("restrict.txt")
matrix b = zeros(4,1)
scalar bi
loop i=1..4 -q
if (i == 1)
s = strstr(s, "const")
else
s = strstr(s, "\n") + 3
endif
s = strstr(s, " ")
sscanf(s, "%lf", &bi)
b[i] = bi
endloop
printf "\n%10.6g\n", b
</script>
Allin Cottrell