Description Usage Arguments Value See Also Examples

Function to get a MCMC simulation results based on the imported MVN mixture distribution. It is commonly used for inquiring the specified conditional probability of MVN mixture distribuiton calculated through Bayesian posteriori.

1 2 3 4 5 | ```
# Bayesian posteriori mix MVN as input data:
# data <- MixMVN_BayesianPosteriori(dataset2[,1:4], 3)
# run MCMC simulation based on Bayesian posteriori mix MVN:
MixMVN_MCMC(data, steps, pars, values, tol, random_method, ...)
``` |

`data` |
A matrix-like data containing the mixture probability, mean vector and covariance matrix for each cluster in each row. |

`steps` |
A positive integer. The numbers of random vectors to be generated for MCMC step. |

`pars` |
A integer vector to declare fixed dimension(s). For example if the desired dimensions are 1st=7 and 3rd=10, set this argument as c(1,3). |

`values` |
A numeric vector to assign value(s) to declared dimension(s). For example if the desired dimensions are 1st=7 and 3rd=10, set this argument as c(7,10). |

`tol` |
Tolerance. A numeric value to control the generated vectors to be accepted or rejected. Criterion uses Euclidean distance in declared dimension(s). Default value is 0.3. |

`random_method` |
The method to generate random vectors. Options are |

`...` |
Other arguments to control the process in Gibbs sampling if the |

return a list which contains:

`AcceptRate` |
Acceptance of declared conditions of MCMC |

`MCMCdata` |
All generated random vectors in MCMC step based on MVN mixture distribution |

`Accept` |
Subset of accepted sampling in MCMCdata |

`Reject` |
Subset of rejected sampling in MCMCdata |

`MixMVN_BayesianPosteriori`

, `MixMVN_GibbsSampler`

, `MVN_GibbsSampler`

, `MVN_FConditional`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
library(plyr)
library(mvtnorm)
library(stats)
# dataset2 has 4 parameters: dimen1, dimen2, dimen3 and dimen4:
head(dataset2)
dataset2_dim <- dataset2[,1:4] # extract parametric columns
# Get posteriori parameters of dataset2 using kmeans 3 clustering:
MixBPos <- MixMVN_BayesianPosteriori(dataset2_dim, 3)
# If we want to know when dimen1=1, which clusters are accepted, run:
MixBPos_MCMC <- MixMVN_MCMC(MixBPos, steps=5000, pars=c(1), values=c(1), tol=0.3)
MixBPos_MCMC$AcceptRate
result <- MixBPos_MCMC$MCMCdata
head(result)
# count accepted samples by clustering:
count(result[which(result[,7]==1),5])
library(rgl)
# Visualization using plot3d() if necessary:
# Clustering result in the rest 3 dimensions:
plot3d(result[,2], result[,3], z=result[,4], col=result[,5], size=2)
# Acceptance rejection visualization:
plot3d(result[,2], result[,3], z=result[,4], col=result[,7]+1, size=2)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.