\documentstyle{article}
\pagestyle{empty}
\begin{document}

\noindent
{\Large\bf Example 1: BIVPROB and PROFLIK\\
\phantom{Example 1: }(Ashford and Sowden Miner's Data).}
\vskip.5cm
\noindent This example file shows
 the use of the procedure BIVPROB. This procedure should be
used whenever the dependent variables are given in the form of $2\times 2$
contingecy tables. It is a good practice to set the appropriate libraries,
and to set all globals to default by BPMSET before defining the input
variables and setting the globals as desired. To assess the result of the
globals, see the output files \tt E11.OUT \rm and \tt E12.OUT. \rm  Also
a short profile likelihood analysis is performed. The graphical 
representations made will remain on screen for 5 seconds. If you want to
change this, change the call to HARDCOPY (GAUSS Publication Quality
Graphics Procedure). 


\begin{verbatim}
/*
** FILE BPM.E1
**
** Illustrates the use of BIVPROB and PROFLIK.
*/

library a:\bpm,pgraph;
bpmset;

x={1 22.50,
   1 27.50,
   1 32.50,
   1 37.50,
   1 42.50,
   1 47.50,
   1 52.50,
   1 57.50,
   1 62.50};

y={1841   7  95   9,
   1654   9 105  23,
   1863  19 177  54,
   2357  48 257 121,
   1778  54 273 169,
   1712  88 324 269,
   1324 117 245 404,
    967 152 225 406,
    526 106 132 372};

let indvar=constant age;
let depvar=breathl wheeze;

_restric=1;
_rpar=0;
_rhonorm=1;
_initval=1;
_signif=1;
_tsiatis=1;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
          bivprob(x,y,indvar,depvar);
dos copy bprobit.out e11.out;

_restric=1;
_rpar=1;
_rhonorm=0;
_initval=0;
_signif=0;
_tsiatis=0;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
          bivprob(x,y,indvar,depvar);
dos copy bprobit.out e12.out;
dos del bprobit.out;

cls;
hardcopy("5");
_rpar=0;
_rhonorm=1;
call proflik(x,y,indvar,depvar,0.025,0.6,0.9);

cls;
print "See the files e11.out and e12.out";
\end{verbatim}
\vfill\eject

\noindent
{\Large\bf Example 2: BPROBIT (simulated data).}
\vskip.5cm
\noindent
When the input is in the form of column vectors, either in global matrices
or in a GAUSS dataset, and when they are dichotomous, use BPROBIT. The
dataset used only contain simulated data and can serve only for illustration
of the procedures that take datasets as their input.
\begin{verbatim}
/*
** FILE BPM.E2
**
** Illustrates the use of BPROBIT.
*/

library a:\bpm,pgraph;
bpmset;

x=ones(50,1)~rndn(50,2);
y=round(rndu(50,2));

_restric=1;
_rpar=0;
_rhonorm=1;
_initval=1;
_signif=0;
_tsiatis=0;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=bprobit("",x,y);
dos copy bprobit.out e21.out;

dataset="a:\\bpm";
let indvar=x1 x2 x3 x5;
let depvar=y1 y2;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
          bprobit(dataset,indvar,depvar);
dos copy bprobit.out e22.out;
dos del bprobit.out;

_rpar=2;
hardcopy("5");

{rho,par,pl,tvec,pvec,step,min,max}=bprobit("",x,y);

cls;print "See the files e21.out and e22.out";
\end{verbatim}
\vfill\eject

\noindent
{\Large\bf Example 3: BPROBRS and BPRS\\ 
\phantom{Example 3: }(simulated data).}
\vskip.5cm
\noindent 
When the dependent variables are ordered categorical with $r$ and $s$
categories respectively, BPROBRS and BPRS replace BIVPROB and BPROBIT.
An analysis is performed with BPROBRS, using simulated date, stored in 
$x$ and $y$. The dataset BPM1.DAT contains simulated date, to do an 
analysis with BPRS.

\begin{verbatim}
/*
** FILE BPM.E3
**
** Illustrates the use of BPROBRS and BPRS.
*/

library a:\bpm,pgraph;
bpmset;

r=3;
s=4;
x=ones(20,1)~rndn(20,2);
y=round(rndu(20,r*s));
let indvar=const covar1 covar2;
let depvar=dep1 dep2;

_restric=1;
_rpar=0;
_rhonorm=1;
_initval=0;
_signif=0;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
          bprobrs(x,y,r,s,indvar,depvar);
dos copy bprobit.out e31.out;

dataset="a:\\bpm1";
let indvar=x1 x2;
let depvar=y1 y2;

{teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
          bprs(dataset,indvar,depvar);
dos copy bprobit.out e32.out;
dos del bprobit.out;

cls; print "See the files e31.out and e32.out";
\end{verbatim}
\vfill\eject

\noindent
{\Large\bf Example 4: Selection Procedures\\
\phantom{Example 4: }(simulated data).}
\vskip.5cm
\noindent
For the selection procedures, some extra GAUSS procedures are needed. So
one also needs the libraries STAT and DUTIL, apart from BPM and PGRAPH.
If you are running GAUSS386 and you only have STAT.LIB, make a copy of 
it and call this copy STAT.L32. You will notice that the selection 
procedure using the
score test is a lot faster than the one applying the likelihood ratio test.
The differences between the procedures can be assessed by comparing the
output files E41.OUT through E45.OUT.  

\begin{verbatim}
/*
** FILE BPM.E4
**
** Illustrates the use of selection procedures.
*/

library a:\bpm,stat,pgraph,dutil;
bpmset;

dataset="a:\\bpm";
let indvar=x1 x2 x3 x4 x5 x6;
let depvar=y1 y2;

_initval=0;
{indv,teta,ll,tetra,llt,teta1,ll1,teta2,ll2}=
     bprobsel(dataset,indvar,depvar,.05);
dos copy bprobit.out e41.out; dos copy bprobsel.out e42.out;

dataset="a:\\bpm1";

{indv1,info1}=bprobsc(dataset,indvar,depvar,.05);
dos copy bprobit.out e43.out; dos copy bprobsel.out e44.out;

let depvar=y1;

_final=0;
{indv1,info1}=uprobsel(dataset,indvar,depvar,.05);
dos copy bprobsel.out e45.out;

cls;
print "See the files e41.out through e45.out";
\end{verbatim}
\vfill\eject

\noindent
{\Large\bf Example 5: Case Influence with INFL\\
\phantom{Example 5: }(simulated data).}
\vskip.5cm
\noindent
You will notice that this case influence analysis requires some computation
time. The time depends on the different values of the covariate vector.
When all covariates are discrete, computation time will decrease dramatically.
For illustration purposes, we chose coviariates to be continuous.

\begin{verbatim}
/*
** FILE BPM.E5
**
** Illustrates the use of INFL (Case Influence).
*/

library a:\bpm,pgraph;
bpmset;
hardcopy("5");

dataset="a:\\bpm";
let indvar=x1 x2 x3;
let depvar=y1 y2;

_rpar=0;
_rhonorm=1;
_signif=0;
_tsiatis=0;
_initval=0;

call infl(dataset,indvar,depvar);
dos copy bprobit.out e5.out;
dos del bprobit.out;

print "See e5.out";
\end{verbatim}
\vfill\eject

\noindent
{\Large\bf Example 6: Multivariate Probit with\\ 
\phantom{Example 6: }MPROBIT (simulated data).}
\vskip.5cm
\noindent
The use of MPROBIT is very simple. You just have to specify the inputs and
to examine carefully the output file MPROBIT.OUT. It is a good idea to
call BPMSET before any use of any procedure, to make sure that all globals,
especially the internal ones, are set to their default value. 

\begin{verbatim}
/*
** FILE BPM.E6
**
** Illustrates the use of MPROBIT.
*/

library a:\bpm;
bpmset;

dataset="a:\\bpm2";
let indvar=x1 x2 x3 x4 x5;
let depvar=y1 y2 y3 y4;

{teta,corr}=mprobit(dataset,indvar,depvar);

print "See mprobit.out";
\end{verbatim}



\end{document}
