Learn R Programming

CHAT (version 1.1)

getDPfit: MCMC fitting for single sample

Description

This function implements MCMC with Dirichlet process prior on a numeric vector.

Usage

getDPfit(y, alpha = 0.05, low.thr = 0.05,prior,mcmc)

Arguments

y
input numeric vector, can be either sAGP or CCF from one sample.
alpha
significance level.
low.thr
values below this threshold in y will be omitted.
prior
a list of prior parameters required for DPdensity. An example is data(prior).
mcmc
a list of parameters required to run MCMC for DPdensity. An example is data(mcmc).

Value

A list is returned. In case of model 0, the list contains:
model
always 0
In case of model 1, the list contains:
PA0
peak information, always equals -1.
A
proportion of Uniform component.
mu
mean of Normal component.
sigma
standard deviation of Normal component.
P
P-value
model
always 1
In case of model 2, the list contains:
PA0
peak information
x,y
density function fitted by MCMC.
P
P value
model
always 2.

Details

Three models are evaluated in this function. 0) There is not enough events (n<5) to="" evaluate="" which="" model="" is="" true.="" 1)="" normal-uniform="" mixture="" and="" 2)="" normal="" with="" unknown="" number="" of="" guassian="" peaks.="" the="" first="" evaluated="" by="" SampleNMM(), and the second by MCMC fitting. The two models are compared by BIC scores and a P-value is obtained from likelihood ratio test.

Examples

Run this code

data(mcmc)
data(prior)
## model 1
y1=c(runif(50),rnorm(100,0.5,0.1))
getDPfit(y1,prior=prior,mcmc=mcmc)$model
## model 2
y2=c(rnorm(100,0.3,0.05),rnorm(100,0.7,0.05))
getDPfit(y2,prior=prior,mcmc=mcmc)$model

Run the code above in your browser using DataLab