Learn R Programming

pcensmix (version 1.2-1)

run_pcensmix: Generating Progressively Type-II Censored Mixture Data and Fitting a Model

Description

This function implements an algorithm using the mixgen, pcgen and pcensmixSim functions to generate data and fit a model using EM algorithm with a specified number of iterations.

Usage

run_pcensmix(N, r, p, param, repetition = 100)

Arguments

N

population size.

r

required number of failures to observe.

p

a parameter controlling the amount of censoring. The action of censoring individuals after each failure occurs with probabilty p from a binomial distribution at each stage. If p = 0, there will be no censoring.

param

a numeric vector; used as starting values for the EM and simulating a new data to replace in case of happening singularity in the likelihood.

repetition

the required number of repetition of the algorithm-- default is 100.

Value

It returns the parameter estimates given by pcensmixSim with the desired number of repetitions. In each repetition it generates a new normal mixture progressive Type-II censored dataset from the same true parameter values and fits a model.

See Also

pcgen, pcensmixSim, mixgen

Examples

Run this code
# NOT RUN {
## Example 1: with very well separated mixture components
set.seed(3)
f1 <- run_pcensmix(N = 160, r = 120, p = 0.3, param = c(10, 2, 25, 4, 0.3), repetition = 100)
colMeans(f1)

## Example 2.
set.seed(150)
f2 <- run_pcensmix(N = 160, r = 130, p = 0.35, param = c(10, 2, 17, 4, 0.3), repetition = 100)
colMeans(f2)

## Example 3.
set.seed(20)
f3 <- run_pcensmix(N = 160, r = 130, p = 0.3, param = c(20, 6, 22, 12, 0.6), repetition = 100)
colMeans(f3)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab