/************** SCATTER ***************************
**   Purpose: Produce a scatter plot from two series.
**   Written by Alan G. Isaac for public non-commercial use.
**   There are no performance guarantees for this code.
**   Suggestions for extensions are welcome.
**   Last update: 15 May 1996
**
**   Alan G. Isaac
**    Mail:         Department of Economics
**                  The American University
**                  Washington, DC 20016
**                  USA
**    Internet:     aisaac@american.edu
**  inputs:
**    y - vector, y-axis series
**    yname -string, y-axis label
**    x - vector, x-axis series
**    xname -string, x-axis label
**    titile1 - string, graph title
**  requires:
**    library pgraph;
***************************************************/
proc (0) = scatter(y,yname,x,xname,title1);
  local c,b,x1,yfit,e,t;
  scale(x,y);
  c=ones(rows(y),1);
  _pstype=1;
  _psymsiz=2;
  _plctrl={-1,0};
  x1=c~x;
  b=y/x1;
  yfit=x1*b;
  e=y-yfit;
  t=b./sqrt(diag(invpd(x1'x1)*(e'e)/(rows(e)-2)));
  title(title1$+"\L T-ratio="$+ftocv(t[2],1,1));
  xlabel(xname);
  ylabel(yname);
  xy(x,y~yfit);
retp;
endp;