Displaying 1 result from an estimated 1 matches for "fprobit".
Did you mean:
probit
2011 Nov 30
1
How can I pick a matrix from a function? (Out Product of Gradient)
...mmands?
Thanks,
Yanghao
============================================================
X <- cbind(rep(1,n),sex,age,yrmarry,children,rating)
dy <- (mydata$y>0)*1
# *********************************************
# Probit model: log-likelihood
# *********************************************
fprobit <- *function*(beta,y,X) {
n <- length(y)
k <- ncol(X)
b <- beta[1:k]
kk <- 2*y-1
z <- X %*% b
L <- log(pnorm(kk*z))
L <- sum(L)
return(-L)
}
# *********************************************
# Probit model: analytic gradient
# *********************************************
gp...