Learn R Programming

mixtools (version 2.0.0)

spRMM_SEM: Stochastic EM algorithm for semiparametric scaled mixture of censored data

Description

Stochastic EM algorithm for semiparametric scaled mixture for randomly right censored data.

Usage

spRMM_SEM(t, d = NULL, lambda = NULL, scaling = NULL, 
          centers = 2, kernelft = triang_wkde, 
          bw = rep(bw.nrd0(t),length(t)), averaged = TRUE,
          epsilon = 1e-08, maxit = 100, batchsize = 1, verb = FALSE)

Value

spRMM_SEM returns a list of class "spRMM" with the following items:

t

The input data.

d

The input censoring indicator.

lambda

The estimates for the mixing proportions.

scaling

The estimates for the components scaling.

posterior

An \(n\times k\) matrix of posterior probabilities for observation, after convergence of the algorithm.

loglik

The (pseudo) log-likelihood value at convergence of the algorithm.

all.loglik

The sequence of log-likelihood values over iterations.

all.lambda

The sequence of mixing proportions over iterations.

all.scaling

The sequence of scaling parameter over iterations.

meanpost

Posterior probabilities averaged over iterations.

survival

Kaplan-Meier last iteration estimate (a stepfun object).

hazard

Hazard rate last iteration estimate evaluated at final.t.

final.t

Last iteration unscaled sample (see reference).

s.hat

Kaplan-Meier average estimate.

t.hat

Ordered unscaled sample, for testing purpose.

avg.od

For testing purpose only.

hazard.hat

Hazard rate average estimate on t.hat.

batch.t

Batch sample (not ordered), see reference.

batch.d

Associated event indicators just rep(d,batchsize), for testing purpose.

sumNaNs

Internal control of numerical stability.

ft

A character vector giving the name of the function.

Arguments

t

A vector of \(n\) real positive lifetime (possibly censored) durations. If d is not NULL then a vector of random censoring times c occurred, so that \(x= min(x,c)\) and \(d = I(x <= c)\).

d

The vector of censoring indication, where 1 means observed lifetime data, and 0 means censored lifetime data.

lambda

Initial value of mixing proportions. If NULL, then lambda is set to rep(1/k,k).

scaling

Initial value of scaling between components, set to 1 if NULL.

centers

initial centers for initial call to kmeans for initialization.

kernelft

.

bw

Bandwidth in the kernel hazard estimates.

averaged

averaged.

epsilon

Tolerance limit.

maxit

The number of iterations allowed.

batchsize

The batchsize (see reference below).

verb

If TRUE, print updates for every iteration of the algorithm as it runs

Author

Didier Chauveau

References

See Also

Related functions: plotspRMM, summary.spRMM.

Other models and algorithms for censored lifetime data (name convention is model_algorithm): expRMM_EM, weibullRMM_SEM.

Examples

Run this code
if (FALSE) {
n=500 # sample size
m=2 # nb components
lambda=c(0.4, 0.6) # parameters
meanlog=3; sdlog=0.5; scale=0.1
set.seed(12)
# simulate a scaled mixture of lognormals
x <- rlnormscalemix(n, lambda, meanlog, sdlog, scale)
cs=runif(n,20,max(x)+400) # Censoring (uniform) and incomplete data
t <- apply(cbind(x,cs),1,min)
d <- 1*(x <= cs)
tauxc <- 100*round( 1-mean(d),3)
cat(tauxc, "percents of data censored.\n")

c0 <- c(25, 180) # data-driven initial centers (visible modes)
sc0 <- 25/180    # and scaling
s <- spRMM_SEM(t, d, scaling = sc0, centers = c0, bw = 15, maxit = 100)

plotspRMM(s) # default
summary(s)   # S3 method for class "spRMM"
}

Run the code above in your browser using DataLab