Robert's Stochastic thoughts 
  corner   



Asymptotically we'll all be dead separated at birth ?
HOME

Feed

e-mail me

Angry Bear

Brad De Long's Semi Daily Journal

no more mister nice blog

Atrios

Mark Thoma

Matthew Yglesias

Michael Froomkin

Jim Henley

Glenn Greenwald

A Fistful of Euros

Benen and Hilzoy

Norwegianity

Jon Swift

my brother in law

formerly meta&meta

I Hans

Sour Grapes

fafblog:glofish central

voracious rationalist

archives 7/1/02 - 8/1/02 10/1/02 - 11/1/02 12/1/02 - 1/1/03 1/1/03 - 2/1/03 3/1/03 - 4/1/03 4/1/03 - 5/1/03 5/1/03 - 6/1/03 6/1/03 - 7/1/03 9/1/03 - 10/1/03 10/1/03 - 11/1/03 11/1/03 - 12/1/03 12/1/03 - 1/1/04 1/1/04 - 2/1/04 2/1/04 - 3/1/04 3/1/04 - 4/1/04 4/1/04 - 5/1/04 5/1/04 - 6/1/04 6/1/04 - 7/1/04 7/1/04 - 8/1/04 8/1/04 - 9/1/04 9/1/04 - 10/1/04 10/1/04 - 11/1/04 11/1/04 - 12/1/04 12/1/04 - 1/1/05 1/1/05 - 2/1/05 2/1/05 - 3/1/05 3/1/05 - 4/1/05 4/1/05 - 5/1/05 5/1/05 - 6/1/05 6/1/05 - 7/1/05 7/1/05 - 8/1/05 8/1/05 - 9/1/05 9/1/05 - 10/1/05 10/1/05 - 11/1/05 11/1/05 - 12/1/05 12/1/05 - 1/1/06 1/1/06 - 2/1/06 2/1/06 - 3/1/06 3/1/06 - 4/1/06 4/1/06 - 5/1/06 5/1/06 - 6/1/06 6/1/06 - 7/1/06 7/1/06 - 8/1/06 8/1/06 - 9/1/06 9/1/06 - 10/1/06 10/1/06 - 11/1/06 11/1/06 - 12/1/06 12/1/06 - 1/1/07 1/1/07 - 2/1/07 2/1/07 - 3/1/07 3/1/07 - 4/1/07 4/1/07 - 5/1/07 5/1/07 - 6/1/07 6/1/07 - 7/1/07 7/1/07 - 8/1/07 8/1/07 - 9/1/07 9/1/07 - 10/1/07 10/1/07 - 11/1/07 11/1/07 - 12/1/07 12/1/07 - 1/1/08 1/1/08 - 2/1/08 2/1/08 - 3/1/08 3/1/08 - 4/1/08 4/1/08 - 5/1/08 5/1/08 - 6/1/08 6/1/08 - 7/1/08 7/1/08 - 8/1/08 8/1/08 - 9/1/08 9/1/08 - 10/1/08 10/1/08 - 11/1/08 11/1/08 - 12/1/08 12/1/08 - 1/1/09 1/1/09 - 2/1/09 2/1/09 - 3/1/09 3/1/09 - 4/1/09 4/1/09 - 5/1/09 5/1/09 - 6/1/09 6/1/09 - 7/1/09 7/1/09 - 8/1/09 8/1/09 - 9/1/09 9/1/09 - 10/1/09 10/1/09 - 11/1/09 11/1/09 - 12/1/09 12/1/09 - 1/1/10 1/1/10 - 2/1/10 2/1/10 - 3/1/10 3/1/10 - 4/1/10 4/1/10 - 5/1/10 5/1/10 - 6/1/10 6/1/10 - 7/1/10 7/1/10 - 8/1/10 8/1/10 - 9/1/10 9/1/10 - 10/1/10 10/1/10 - 11/1/10 11/1/10 - 12/1/10 12/1/10 - 1/1/11 1/1/11 - 2/1/11 2/1/11 - 3/1/11 3/1/11 - 4/1/11 4/1/11 - 5/1/11 5/1/11 - 6/1/11 6/1/11 - 7/1/11 7/1/11 - 8/1/11 8/1/11 - 9/1/11 9/1/11 - 10/1/11 10/1/11 - 11/1/11 11/1/11 - 12/1/11 12/1/11 - 1/1/12 1/1/12 - 2/1/12 2/1/12 - 3/1/12 3/1/12 - 4/1/12 4/1/12 - 5/1/12 5/1/12 - 6/1/12 6/1/12 - 7/1/12 7/1/12 - 8/1/12 8/1/12 - 9/1/12 9/1/12 - 10/1/12 10/1/12 - 11/1/12 11/1/12 - 12/1/12 12/1/12 - 1/1/13 1/1/13 - 2/1/13 2/1/13 - 3/1/13 3/1/13 - 4/1/13 4/1/13 - 5/1/13 5/1/13 - 6/1/13 6/1/13 - 7/1/13
 

Friday, September 01, 2006

 
econgeek has left a new comment on your post "9/01/2006 06:28:00 AM":

and why exactly are you posting this here?

The post below was meant as a joke. More exactly it was the punchline to the joke at the end of the post immediately below it (posted just before it). Unfortunately, that post has been sent to the archive so this post is not just a semi debugged gauss program but also a very feeble punchline without a joke.


A Gauss program

n = 1000;
tb=20;

tg=1|1;

sn = 1;
se = 1;


z = rndn(n,2);
x = z*tg+sn*(rndn(n,1));
y = z*tg*tb+se*(rndn(n,1));




b1 = 0;
b2 =200;

c=8;


n=rows(y);
onen2= ones(n+2,1);

z = z|zeros(2,2);
x = x|zeros(2,1);
y = y|zeros(2,1);







r2s=(y-x*b1).*(y-x*b1);
r2s = sortc(r2s,1);
v1 = (0.5*(r2s[ floor((n+5)/2)]+r2s[floor((n+6)/2)]));



w1=(onen2 - (y-x*b1).^2/(c^2*v1)).* (((y-x*b1).^2).<(c*c*v1));

yw1 = y.*w1;
xw1 = x.*w1;
zw1 = z.*w1;



if b2==b1;
goto ddone;
endif;

gam1 = xw1/zw1;

/* here I orthogonalise zw1 so that it is easy to add an new observation that doesn't change gamma*/

mat1 = gam1~(0|1);
zw1a= zw1*mat1;
rhoz = zw1a[.,2]/zw1a[.,1];

mat2 = (1|0)~(-rhoz|1);

zw1a=zw1a*mat2;


czx1 = (zw1a[.,1])'xw1;
czy1 = (zw1a[.,1])'yw1;

zw1a[n+1,1]= meanc(abs(zw1a[.,1]));

x[n+1,1]=(czy1-czx1*b2)/((b2-b1)*zw1a[n+1,1]);
y[n+1,1]=x[n+1,1]*b1;

xw1[n+1,1]=x[n+1,1];
yw1[n+1,1]=y[n+1,1];

/*back to original z*/

zw1=zw1a*inv(mat2)*inv(mat1);

xhw1 = zw1*(xw1/zw1);


z[n+1,.]=zw1[n+1,.];

r2s=(y-x*b2).*(y-x*b2);
r2s = sortc(r2s,1);
v2 = (0.5*(r2s[ floor((n+3)/2)]+r2s[floor((n+4)/2)]));

w2=(onen2 - (y-x*b2).^2/(c^2*v2)).* (((y-x*b2).^2).<(c*c*v2));


/*do or redo obs n+2*/


zw2 = z.*w2;
xw2 = x.*w2;
yw2 = y.*w2;

rhoz2 = zw2[.,2]/zw1[.,1];

mat3 = (1|0)~(-rhoz2|1);

zw2a = zw2*mat3;



zw2a1 = zw2a[.,1];
zw2a2 = zw2a[.,2];


if ((zw2a1'yw2/zw2a1'xw2)==b2)*((zw2a2'yw2/zw2a2'xw2)==b2)*(w2[n+2]==0)==1;
goto ddone;
endif;

if ((zw2a1'yw2/zw2a1'xw2)==(zw2a2'y/zw2a1'x))*((zw2a1'y/zw2a1'x)==b2)*(w2[n+2]>0)==1;
goto redw1;
endif;

if ((zw2a1'yw2/zw2a1'xw2)==(zw2a2'y/zw2a1'x))*((zw2a1'y/zw2a1'x==b2)==0);

xw2a[n+2]=(xw2a/zw2a)*(meanc(abs(zw2a)));
zw2a[n+2,1]=meanc(abs(zw2a[.,1]));
yw2a[n+2]=b2*xw2a[n+2];
endif;

lam = (b2*zw2a2'xw2-zw2a2'yw2)/(zw2a1'yw2-b2*zw2a1'xw2);

mat4 = (lam|1)~(0|1);

zw2b=zw2a*mat4;

rhoz3 = (zw2b[.,2]/zw2b[.,1]);

mat5 = (1|0)~(-rhoz3|1);


zw2c = zw2b*mat5;


zw2c[n+2,2]= meanc(zw2c[.,2]);

xw2[n+2]=-(zw2c[1:n+1,2])'xw2[1:n+1]/zw2c[n+2,2];
yw2[n+2] = xw2[n+2]*b2;


/*back to original z*/

zw2 = zw2c*inv(mat5)*inv(mat4)*inv(mat3);

z[n+2,.]=zw2[n+2,.];
x[n+2]=xw2[n+2];
y[n+2]=yw2[n+2];


xhw2 = zw2*(xw2/zw2);

"check same final";

(yw2/xhw2)~b2;



redw1:

r2s=(y-x*b1).*(y-x*b1);
r2s = sortc(r2s,1);
v1 = (0.5*(r2s[ floor((n+3)/2)]+r2s[floor((n+4)/2)]));

w1=(onen2 - (y-x*b1).^2/(c^2*v1)).* (((y-x*b1).^2).<(c*c*v1));

yw1 = y.*w1;
xw1 = x.*w1;
zw1 = z.*w1;

xhw1 = zw1*(xw1/zw1);


ddone:;

"final check";
"estimate with w(" b1 "), estimate with w(" b2 "), and b2";



(yw1/xhw1)~(yw2/xhw2)~b2;
"estimate with w(" b1 ") -b2 and estimate with w(" b2 ") - b2";
((yw2/xhw2)-b2)~((yw1/xhw1)-b2);

"z[n+1,.], x[n+1], and y[n+1]"
z[n+1,.] x[n+1] y[n+1];


"z[n+2,.], x[n+2], and y[n+2]"
z[n+2,.] x[n+2] y[n+2];



Comments: Post a Comment



This page is powered by Blogger.