function [beta,se,pv,S,ssr,R2,R2a,F,pvF] = panelfe(y,X,T,display)
% estimate fixed effect panel data model
% regressee: y = (y(11) y(12) ... y(1T) ... y(N1) y(N2) ... y(NT))'
% regressor: X

if nargin < 4 || isempty(display)
    display=0;
end

[n,k] = size(X); % n = N*T, k: number of regressors
N = n/T;

Z = [X kron(eye(N), ones(T, 1))];
[beta,se,pv,S,ssr,R2,R2a,F,pvF] = myols(y, Z);

if nargout < 1 || display
    disp('     Coef Est    S.E.   p-value')
    disp([beta(1:k) se(1:k) pv(1:k)])
    disp('N      SSR      R2      F')
    disp([N ssr R2 F])
end

