pcgen: Creating a Progressively Type-II Censored Version of a Given...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/pcensmix.R

Description

This function implements an algorithm for generating a progressive Type-II censored version of a specified dataset.

Usage

1
pcgen(r, p, data)

Arguments

r

desired 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 binomial distribution at each stage. If p = 0, no censoring will happen.

data

a numeric vector of a real dataset (mixture/not mixture) or an object of class data.frame generated by mixgen.

Details

It creates a progressive Type-II censored version of a given real dataset or a simulated dataset from mixgen. The output of this function can be passed as an argument to pcensmixR or pcensmixSim for the purpose of fitting a normal mixture model to the progressively censored dataset.

Value

An object of class "pcgen" containing the following information:

original_data

original mixture data

label

component membership indicator for the original simulated mixture data. This will not be returned if a real data has been used.

censored_version_of_data

progressive Type-II censored version of data, i.e., each observation is equal to the actual observed survival time in the event of failure and is equal to the latest observe failure time if it is associated to an unobserved censored observation. Notice that they are order statistics.

component_indicator

component indicator associated with the censored_verison_of_data. This will not be returned if a real data has been used.

censoring_indicator

censoring indicator associated with the censored_verison_of_data.

Note

See print.pcgen for printing data of class "pcgen".

Author(s)

Lida Fallah, John Hinde

Maintainer: Lida Fallah <l.fallah22@gmail.com>

See Also

mixgen, print.pcgen.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 1. Generate a progressive Type-II censored data from a simulated mixture data with
## allowing for censoring with controlling parameters p = 0.3 and r = 12.
set.seed(0)
mixture <- mixgen(N = 20, dist1 = 'norm', dist2 = 'weibull', control = list(12, 2, 15, 4, 0.3))
Pdat0 <- pcgen(r = 12, p = 0.3, data = mixture)
print(Pdat0)


## 2. Examples of generating a progresively Type-II censored data

set.seed(0)
Pdat1 <- pcgen(r = 6, p = 0.3, data = insulate)
print(Pdat1)

set.seed(100)
Pdat2 <- pcgen(r = 260, p = 0.35, data = blood$Systolic.BP)
print(Pdat2)

pcensmix documentation built on May 2, 2019, 1:10 p.m.