getDPfit: MCMC fitting for single sample

Description Usage Arguments Details Value Author(s) Examples

View source: R/getDPfit.R

Description

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

Usage

1
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).

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 mixture with unknown number of Guassian peaks. The first model is 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.

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.

Author(s)

Bo Li

Examples

1
2
3
4
5
6
7
8
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

CHAT documentation built on May 29, 2017, 10:32 p.m.