R/frm_oprobit_density.R

Defines functions frm_oprobit_density

## File Name: frm_oprobit_density.R
## File Version: 0.17

frm_oprobit_density <- function(model, y, design_matrix=NULL, case=NULL)
{
    if ( is.null(design_matrix) ){
        y_pred <- predict(model)
    } else {
        y_pred <- predict(model, newdata=design_matrix)
    }
    logthresh <- model$coefficients[ model$index_thresh ]
    thresh <- logthresh_2_thresh(x=logthresh)
    d1 <- mdmb_regression_oprobit_density( y=y, ypred=y_pred, thresh=thresh, log=FALSE)
    d2 <- frm_normalize_posterior( post=d1, case=case )
    res <- list( "like"=d1, "post"=d2 )
    return(res)
}

Try the mdmb package in your browser

Any scripts or data that you put into this service are public.

mdmb documentation built on March 7, 2023, 6:58 p.m.