plotly_weibullRMM: Plot sequences from the Stochastic EM algorithm for mixture...

View source: R/plotly_weibullRMM.R

plotly_weibullRMMR Documentation

Plot sequences from the Stochastic EM algorithm for mixture of Weibull using plotly

Description

This is an updated version of plotweibullRMM function by using plotly function. For technical details, please refer to plotweibullRMM.

Usage

  plotly_weibullRMM(a, title=NULL, rowstyle=TRUE, subtitle=NULL,
                    width = 3 , col = NULL , 
                    title.size = 15 , title.x = 0.5 , title.y = 0.95,
                    xlab = "Iterations" , xlab.size = 15 , xtick.size = 15,
                    ylab = "Estimates" , ylab.size = 15 , ytick.size = 15,
                    legend.size = 15)

Arguments

a

An object returned by weibullRMM_SEM.

title

The title of the plot, set to some default value if NULL.

rowstyle

Window organization, for plots in rows (the default) or columns.

subtitle

A subtitle for the plot, set to some default value if NULL.

width

Line width.

col

Color of lines. Number of colors specified needs to be consistent with number of components.

title.size

Size of the main title.

title.x

Horsizontal position of the main title.

title.y

Vertical posotion of the main title.

xlab

Label of X-axis.

xlab.size

Size of the lable of X-axis.

xtick.size

Size of tick lables of X-axis.

ylab

Label of Y-axis.

ylab.size

Size of the lable of Y-axis.

ytick.size

Size of tick lables of Y-axis.

legend.size

Size of legend.

Value

The plot returned.

Author(s)

Didier Chauveau

References

See Also

Related functions: weibullRMM_SEM, summary.mixEM, plotweibullRMM.

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

Examples

n = 500 # sample size
m = 2 # nb components
lambda=c(0.4, 0.6)
shape <- c(0.5,5); scale <- c(1,20) # model parameters
set.seed(321)
x <- rweibullmix(n, lambda, shape, scale) # iid ~ weibull mixture
cs=runif(n,0,max(x)+10) # iid censoring times
t <- apply(cbind(x,cs),1,min) # censored observations
d <- 1*(x <= cs) # censoring indicator
## set arbitrary or "reasonable" (e.g., data-driven) initial values
l0 <- rep(1/m,m); sh0 <- c(1, 2); sc0 <- c(2,10)
# Stochastic EM algorithm
a <- weibullRMM_SEM(t, d, lambda = l0, shape = sh0, scale = sc0, maxit = 200)
summary(a) # Parameters estimates etc
plotly_weibullRMM(a , legend.size = 20) # plot of St-EM sequences



mixtools documentation built on Dec. 5, 2022, 5:23 p.m.