Learn R Programming

bmixture (version 1.7)

plot.bmixgamma: Plot function for S3 class "bmixgamma"

Description

Visualizes the results for function bmixgamma.

Usage

# S3 method for bmixgamma
plot( x, ... )

Arguments

x

An object of S3 class "bmixgamma", from function bmixgamma.

System reserved (no specific usage).

See Also

bmixgamma

Examples

Run this code
# NOT RUN {
# simulating data from mixture of gamma with two components
n      = 500 # number of observations
weight = c( 0.6, 0.4 )
alpha  = c( 12 , 1   )
beta   = c( 3  , 2   )

data <- rmixgamma( n = n, weight = weight, alpha = alpha, beta = beta )
  
# plot for simulation data    
hist( data, prob = TRUE, nclass = 50, col = "gray" )
  
x     = seq( 0, 10, 0.05 )
truth = dmixgamma( x, weight, alpha, beta )
      
lines( x, truth, lwd = 2 )
  
# Runing bdmcmc algorithm for the above simulation data set      
bmixgamma.obj <- bmixgamma( data )
    
plot( bmixgamma.obj )
# }

Run the code above in your browser using DataLab