Learn R Programming

CHAT (version 1.1)

ApproxBIC: Approximate BIC calculation

Description

Calculate approximate BIC for a given distribution and number of free parameters in the model.

Usage

ApproxBIC(Y, fit.x, fit.y, n)

Arguments

Y
input data vector, distribution of which is estimated.
fit.x
x coordinates of the fitted probability density function for Y
fit.y
y coordinates of the fitted probability density function for Y
n
number of parameters in the model

Value

numeric, BIC score.

Details

This function is a follow-up of MCMC fitting of a complicated distribution. fit.x and fit.y come from the fitting of Dirichlet process prior on sAGP or CCF distributions.

Examples

Run this code

data(mcmc)
data(prior)
library(DPpackage)
Y=c(rnorm(40,0.4,0.05),rnorm(40,0.8,0.05))
vv=which(Y>0.05&Y<1)
fit=DPdensity(Y,status=TRUE,mcmc=mcmc,prior=prior)
BIC=ApproxBIC(Y,fit$x1,fit$dens,length(prior))

Run the code above in your browser using DataLab