# Use the function generatedata_mpin() to generate a dataset of
# 60 days according to the assumptions of the original PIN model.
sdata <- generatedata_mpin(layers = 1)
xdata <- sdata@data
# Estimate the PIN model using the Bayesian approach developed in
# Griffin et al. (2021), and initial parameter sets generated using the
# algorithm of Ersan and Alici (2016). The argument xtraclusters is
# set to 1. We also leave the arguments 'sweeps' and 'burnin' at their
# default values.
# \donttest{
estimate <- pin_bayes(xdata, xtraclusters = 1, verbose = FALSE)
# Display the empirical PIN value at the data, and the PIN value
# estimated using the bayesian approach
setNames(c(sdata@emp.pin, estimate@pin), c("data", "estimate"))
# Display the empirial and the estimated parameters
show(unlist(sdata@empiricals))
show(estimate@parameters)
# Find the initial set that leads to the optimal estimate
optimal <- which.max(estimate@details$likelihood)
# Store the matrix of Monte Carlo simulation for the optimal
# estimate, and display its last five rows
mcmatrix <- estimate@details$markovmatrix[[optimal]]
show(tail(mcmatrix, 5))
# Display the summary of Geweke test for the Monte Carlo matrix above.
show(estimate@details$summary[[optimal]])
# }
Run the code above in your browser using DataLab