Quantcast
Channel: Statistics Help @ Talk Stats Forum - SAS
Viewing all articles
Browse latest Browse all 310

Why do SAS and Matlab give me different answers for my OLS regression?

$
0
0
Hi,
i'm trying to run the same OLS regresion in SAS and Matlab but they gave me different answers. The regression is:

R_t = β_0 + B*F_t + β_L*L_t + e_t

Where R_t is a 10X1 vector , F_t is a 4x1 vector, B is a 10x4 matrix, and β_0 and β_L are 10x1 vector.

For SAS I use the next code:

proc reg data=datain outest= dataout tableout noprint;
by id;
model R = F_1 F_2 F_3 L/ hcc adjrsq;
run;

I did the same thing with Matlab (I think??)
with R (300x10 matrix) contains time-series data of 10 different id, and matrix
F = [ones(300,1) F_1 F_2 F_3 L];
betas = inv(transpose(F)*F)*transpose(F)*R;

Shouldn't they give me the same answers or did i do something wrong? Thanks

Viewing all articles
Browse latest Browse all 310

Trending Articles