# When estimating a System of Equations, how do I copy the coefficients to a matrix?

I am struggling with a little problem. When estimating a system, and storing the coefficients in a vector called beta, I would like to copy these coefficients into a 4x6 matrix. I am not able to do this. Can you help?

See my example below:

sample 1 100
genr p1=1+nor(1)
genr p2=1+nor(1)
genr p3=1+nor(1)
genr p4=1+nor(1)
genr x=1+nor(1)
genr q1=20-10*p1+2*p2+0.5*p3+1.5*p4+4*x+nor(20)
genr q2=10+0.5*p1-1*p2+1.5*p3+0.5*p4+6*x+nor(30)
genr q3=40+3*p1+1*p2-1.5*p3+2.5*p4+2*x+nor(20)
genr q4=30+2*p1+1*p2+2.5*p3-3.5*p4+3*x+nor(30)
genr one=1

system 4 / DN noconstant coef=beta
ols q1 one p1 p2 p3 p4 x
ols q2 one p1 p2 p3 p4 x
ols q3 one p1 p2 p3 p4 x
ols q4 one p1 p2 p3 p4 x
end
stop

edit retag close merge delete

Sort by » oldest newest most voted

coefmat=beta


rather than

coef=beta


The result is a 6 by 4 matrix which you can transpose if required.

more

How would you do it for a function that does not take coefmat as an option? For example, the function, FLS.