new;

#include estima;

k=4;
n=300;
beta=0|(2*ones(k-1,1));
x=ones(n,1)~rndn(n,k-1);
eps=rndn(n,1)^3;

ystar=x*beta+eps;
y=ystar.*(ystar.gt 0);

{b1,s1}=est_clad(y,x);
{b2,s2}=est_scls(y,x);
xmc=x[.,2:cols(x)];
{b3,s3}=est_poho(y,xmc);

output file=demo.out;
output reset;

"DESIGN 1";
" ";

"CLAD";
(b1~s1)';

"SCLS";
(b2~s2)';

"POHO";
(b3~s3)';

output off;

k=4;
n=300;
beta=0|(2*ones(k-1,1));
x=ones(n,1)~rndn(n,k-1);
eps=8*(rndu(n,1)-0.5);

ystar=x*beta+eps;
y=ystar.*(ystar.gt 0);

{b1,s1}=est_clad(y,x);
{b2,s2}=est_scls(y,x);
xmc=x[.,2:cols(x)];
{b3,s3}=est_poho(y,xmc);

output on;
" ";
"DESIGN 2";
" ";

"CLAD";
(b1~s1)';

"SCLS";
(b2~s2)';

"POHO";
(b3~s3)';

output off;

/* panel example */

k=4;
n=300;
beta=0|(2*ones(k-1,1));
x1=ones(n,1)~rndn(n,k-1);
x2=ones(n,1)~rndn(n,k-1);
al=0.5*(x1[.,2]+x2[.,2]);
eps1=8*(rndu(n,1)-0.5);
eps2=8*(rndu(n,1)-0.5);
ystar=x1*beta+al+eps1;
y1=ystar.*(ystar.gt 0);
ystar=x2*beta+al+eps2;
y2=ystar.*(ystar.gt 0);

xmc1=x1[.,2:cols(x1)];
xmc2=x2[.,2:cols(x2)];

{b1,s1}=est_fix(y1,xmc1,y2,xmc2);

output on;
" ";
"PANEL";
" ";

(b1~s1)';

output off;



