/* jagols1.prg does OLS with application to Jaggia data.
In practice we need more complicated data read in than this,
and need to associate variables names with the output.
*/
/* The original data are from Sanjiv Jaggia and Satish Thosar, 1993,
"Multiple Bids as a Consequence of Target Management Resistance"
Review of Quantitative Finance and Accounting, 447-457.
The data in the ascii file jaggia.asc are
on 126 firms, 12 variables per firm:
1. DOCNO Doc No.
2. WEEKS Weeks
3. NUMBIDS Count (Dependent Variable)
4. TAKEOVER Delta (1 if taken over)
5. BIDPREM Bid Premium
6. INSTHOLD Institutional Holdings
7. SIZE Size measured in billions
8. LEGLREST Legal Restructuring
9. REALREST Real Restructuring
10. FINREST Financial Restructuring
11. REGULATN Regulation
12. WHTKNGHT White Knight
In addition we need to create
13. SIZESQ Size Squared
This program performs OLS regression of
NUMBIDS
on ten regressors including the intercept:
intercept,LEGLREST,REALREST,FINREST,WHTKNGHT,BIDPREM,
INSTHOLD,SIZE,SIZESQ,REGULATN
*/
/******* Initial setup: libraries used etc. and output file *******
*/
New; @ clear workspace @
outfile = "jagols1.out";
output file = ^outfile reset;
print "File jagols1.out is output from Gauss program jagols1.src";
print "Date is:";
print date;
/******* Read in the data and create variables *******
Here for simplicity we read the data in as a flat ascii file.
The data are ordered by observation, with four variables
per line so that the first observation (on 12 variables)
takes up the first three lines etc.
In practice we would use a Gauss data set with names provided.
*/
load data[126,12] = jaggia.asc;
DOCNO = data[.,1];
WEEKS = data[.,2];
NUMBIDS = data[.,3];
TAKEOVER = data[.,4];
BIDPREM = data[.,5];
INSTHOLD = data[.,6];
SIZE = data[.,7];
LEGLREST = data[.,8];
REALREST = data[.,9];
FINREST = data[.,10];
REGULATN = data[.,11];
WHTKNGHT = data[.,12];
SIZESQ = SIZE.*SIZE;
ONE = ones(126,1);
x = ONE~LEGLREST~REALREST~FINREST~WHTKNGHT~BIDPREM~
INSTHOLD~SIZE~SIZESQ~REGULATN;
y = NUMBIDS;
/* Check data by getting means */
xmean = x'one/126;
ymean = y'one/126;
print;
print "Sample means of the regressors:";
print xmean;
print "Sample mean of the dependent variable";
print ymean;
/******** Do the statistical analysis *********/
/* perform ols regression */
bols = invpd(x'x)*x'y;
/* Obtain White robust standard errors and t-statistics */
/* This uses a special feature of Gauss:
The operator .* is element-by-element multiplication
The operator ./ is element-by-element division */
uhat = y - x*bols;
uhatsq = uhat.*uhat;
covols = invpd(x'x)*(x'(x.*uhatsq))*invpd(x'x)*(rows(x)/(rows(x)-cols(x)));
varols = diag(covols);
seols = sqrt(varols);
tols = bols./seols;
/* For standard errors with homoskedastic errors instead
sigmasq = uhat'uhat/(rows(x)-cols(x));
covols = sigmasq*invpd(x'x); */
/* print results */
print;
print "OLS regression of NUMBIDS on intercept, LEGLREST, REALREST,FINREST,";
print "WHTKNGHT,BIDPREM,INSTHOLD,SIZE,SIZESQ and REGULATN";
print;
print "OLS estimates, heteroskedastic-consistent standard errors and t-statistics";
print bols~seols~tols;
output off;