# NOT RUN {
library(MASS)
n<-500
delta<-c(0.5,0.6,0.1,-1,1)
beta<-c(-0.3,-0.5,0,-0.4,-0.3)
X<-cbind(rep(1,n),rnorm(n),runif(n),rbinom(n,2,0.5),rbinom(n,1,0.5))
x<-X[,-1]
rho=0.4
error<-mvrnorm(n,c(0,0),matrix(c(1,rho,rho,1),2))
zstar<-X%*%delta+error[,1]
z<-as.numeric(zstar>0)
ystar<-X%*%beta+error[,2]
y<-as.integer(ystar>0)
y[z==0]<-NA
data=data.frame(y=y,x1=x[,1],x2=x[,2],x3=x[,3],x4=x[,4])
m<-ui.probit(y~x1+x2+x3+x4,data=data,rho=c(0,0.5))
m
plot(m)
profile(m)
# }
Run the code above in your browser using DataLab