Displaying 1 result from an estimated 1 matches for "simprobit".
Did you mean:
  mprobit
  
2003 Sep 08
1
Probit and optim in R
...0,3)
#Set counter and start loop
j <- 1
while (j < 11){
#Simulate Data
x1 <- rnorm(1000) 
x2 <- rnorm(1000)
latentz <- 1.0 + 2.0 * x1 - 3.0 * x2 + rnorm(1000)
y <- latentz
y[latentz < 1] <- 0
y[latentz >=1] <- 1
#Option export of data to check estimates in STATA
#SimProbit <- data.frame(y, x1, x2)
#write.table(SimProbit, 'a:/SimProbit')
x <- cbind(1, x1 ,x2)
#Define Likelihood
llik.probit<-function(par, X, Y){
Y <- as.matrix(y)
X <- as.matrix(x)
K <- ncol(X)
b <-as.matrix(par[1:K])
 
  phi<-pnorm(X%*%b, mean=0, sd=1, lower.tail = T...