#' Log likelihood function
#'
#' This is the loglikelihood function used in the probit estimation.
#' This function doesn't do anything on its own, its
loglik_probit <- function(param, X, y){
#param have ncol(X)+1 element (sigma)
b= param[0:ncol(X)]
sigma=param[length(param)]
# adding a col of 1 to matrix of covariates X
xb=X %*% b
result=ifelse(y>0, pnorm(xb/sigma,log=T), 1-pnorm(xb/sigma,log=T))
return(sum(result))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.