SHAZAM Community
Ask Your Question

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

asked 2011-03-12 07:23:51 +0000

updated 2011-03-12 08:50:21 +0000

David gravatar image

A SHAZAM User asked:

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
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2011-03-12 07:24:26 +0000

David gravatar image

Please use the option


rather than


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

edit flag offensive delete link more


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

OYassin gravatar imageOYassin ( 2014-01-10 13:26:37 +0000 )edit
Login/Signup to Answer

Question Tools


Asked: 2011-03-12 07:23:51 +0000

Seen: 763 times

Last updated: Mar 12 '11