Displaying 1 result from an estimated 1 matches for "heckpll".
Did you mean:
heckl
2009 Jul 01
0
probit with sample selection error?
...tart = solve(qr(x),y)
b=optim(bstart,probll,y=y,x=x,hessian=F)$par
return(b)
}
probll<-function(bstart,y,x){
prob=pnorm(x%*%bstart);
ll= -sum(y*log(prob)+(1-y)*log(1-prob));
return(ll)
}
heckprob<-function(y1,x1,y2,x2){
bstart = as.vector(c(iprobit(y1,x1),iprobit(y2,x2),0.5))
b=optim(bstart,heckpll,y1=y1,x1=x1,y2=y2,x2=x2,hessian=F)$par
return(b)
}
heckpll<-function(bstart,y1,x1,y2,x2){
y1=as.vector(y1);y2=as.vector(y2);
x1=as.matrix(x1);x2=as.matrix(x2);
p=ncol(x1);
k=ncol(x2);
obs = length(y1);
ll = numeric(obs);
b1 =bstart[1:p];
b2 =bstart[(p+1):(k+p)];
rho=(exp(bstart[(k+p+1)]) - 1)/(...