Setup
Data Structures
ModelCalibration.BulkVarsStruct — Type
BulkVarsStruct(theta::Array{Float64},sig2::Vector{Float64},tau2::Vector{Float64},
delta::Array{Float64},rho::Array{Float64},accept::Array{Bool},ratio::Array{Float64})Data structure containing the samples and Metropolis-Hastings information from the Markov Chain Monte Carlo simulation sampling of the posterior distribution in the Bayesian model calibration.
Keyword arguments
theta::Array{Float64}An Array to store the samples of θ during the MCMC simulation, dimensions n and m.sig2::Vector{Float64}A Vector to store the samples of σ^2 during the MCMC simulation, length n.tau2::Vector{Float64}A Vector to store the samples of τ^2 during the MCMC simulation, length n.delta::Array{Float64}An Array to store the samples of δ during the MCMC simulation, dimensions n and q.rho::Array{Float64}An Array to store the samples of ρ during the MCMC simulation, dimensions n and p.accept::Array{Bool}An Array to store the acceptance status of each Metropolis-Hastings update during the MCMC, dimensions n and p+m.ratio::Array{Float64}An Array to store the acceptance probability of each Metropolis-Hastings update during the MCMC, dimensions n and p+m.
ModelCalibration.CovarPars — Type
CovarPars(ta2::Float64,rho::Float64,sig2::Float64)Struct to store mutable params for covar construction.
Keyword arguments
sig2::Float64Variance parameter for identity portion of covaraince.rho::Float64Correlation parameter.tau2::Float64Variance parameter for correlation portion of covariance.
ModelCalibration.DataStr — Type
DataStr(sim::SimStr,exp::ExpStr)Structure containing both the computer simulator and experimental data structures.
Keyword arguments
sim::SimStrA data structure containing the computer simulator dataexp::ExpStrA data structure containing the experimental data
ModelCalibration.ExpStr — Type
ExpStr(x::Array{Float64},y::Array{Float64},x_reps::Array{Float64},y_reps::Vector{Float64})Structure containing the experimental data to which the surrogate model is calibrated.
Keyword arguments
x::Array{Float64}Array containing all unique settings of the independent control variables in the experimental data. Dimensions n and p where n is the number of unique settings and p is the number of x variables.y::Array{Float64}Array containing all repeated observations of the unique x settings in the experimental data. Dimensions n and m, where n is the number of unique x settings and m is the number of repeated observations.x_reps::Array{Float64}Array containing all settings of the independednt control variables in the experimental data not trimmed to each be unique. Dimensions n*m and p.y_reps::Vector{Float64}Vector containing all response observations in the experimental data not arranged based on unique locations, length n*m.
ModelCalibration.GridData — Type
GridData(phi::GridPar,rho::GridPar)Structure containing the grid information for ϕ and ρ for the Griddy Gibbs precomputation.
Keyword arguments
phi::GridParStructure specifying the bounds and number of grid points to evaluate for ϕ during precomputation.rho::GridParStructure specifying the bounds and number of grid points to evaluate for ρ during precomputation. The bounds should be in (0,1).
ModelCalibration.GridPar — Type
GridPar(density::Int,bounds::ScalePar)Structure containing the density and bounds information of a parameter for the Griddy Gibbs precomputation.
Keyword arguments
density::IntInteger specifying the number of grid points for the parameter to use during precomputation.bounds::ScaleParData structure specifying the lower and upper bounds of the parameter to use for precomputation.
ModelCalibration.GriddyPosteriors — Type
GriddyPosteriors(theta::Array{Float64},sig2::Vector{Float64},phi::Vector{Float64},
rho::Vector{Float64})Struct to store the posterior samples from the griddy Gibbs sampler, converted from the posterior indices.
Keyword arguments
theta::Array{Float64}Array of unknown computer model parameter samples.sig2::Vector{Float64}Vector of data model variance parameter samples.phi::Vector{Float64}Vector of discrepancy variance parameter samples.rho::Vector{Float64}Vector of discrepancy correlation parameter samples.
ModelCalibration.GriddyVarsStruct — Type
GriddyVarsStruct(theta::Vector{Int},sig2::Vector{Float64},phi::Vector{Float64},
rho::Vector{Float64})Data structure containing posterior index samples for the griddy Gibbs sampler.
Keyword arguments
theta::Vector{Int}A Vector to store the index of the values of θ during the MCMC simulation, length n.sig2::Vector{Float64}A Vector to store the samples of τ^2 during the MCMC simulation, length n.phi::Vector{Int}A Vector to store the samples of ϕ during the MCMC simulation, length n.rho::Vector{Int}A Vector to store the samples of ρ during the MCMC simulation, length n.
ModelCalibration.MetropolisInfo — Type
MetropolisInfo(new_value::Float64,ratio::Float64,accept::Bool)Structure used for storing the acceptance information for a single step in the Metropolis-Hastings algorithm.
Keyword arguments
new_value::Float64The new value, θ^(t+1), for the Metropolis-Hastings algorithm. Taken as either θ* or θ^(t) based on acceptance criteria of the proposed value, θ*.ratio::Float64The acceptance probability, α, for the proposed value, calculated from p(θ*)/p(θt).accept::BoolThe logical value determining whether the proposed value was accepted or rejected.
ModelCalibration.PriorData — Type
PriorData(theta::PriorVar,sig2::PriorVar,tau2::PriorVar,rho::PriorVar)Structure containing the PriorVar prior distribution parameters for all parameters in the Bayesian calibration model.
Keyword arguments
theta::PriorVarPrior distribution parameters for the unknown model parameters, θ. The two prior parameters are m length Vectors containing minimum and maximum values corresponding to a uniform prior distribution for each of the m θ variables, respectively.sig2::PriorVarPrior distribution parameters for the data error variance. The two prior parameters are the shapre (α) and scale (β) of an inverse gamma distribution, respectively.tau2::PriorVarPrior distribution parameters for the discrepancy term variance. The two prior parameters are the shapre (α) and scale (β) of an inverse gamma distribution, respectively.rho::PriorVarPrior distribution parameters for the discrepancy term correlation structure. The two parameters are p length Vectors containing the α and β parameters for a Beta distribution for each of the p x variables, respectively.
ModelCalibration.PriorVar — Type
PriorVar(par1::Union{Float64,Vector{Float64}},par2::Union{Float64,Vector{Float64}})Structure containing prior distribution parameters. Currently, only two-parameter prior distributions are supported herein. Parameters are intended to be specified in the typical ordering. Ex: for a normal distribution, par1 = μ, par2 = σ Ex: for a uniform distribution, par1 = min, par2 = max
Keyword arguments
par1::Union{Float64,Vector{Float64}}The first parameter of the prior distributionpar2::Union{Float64,Vector{Float64}}The second parameter of the prior distribution
ModelCalibration.ScalePar — Type
ScalePar(min::Float64,max::Float64)Structure containing the minimum and maximum vales for a variable.
Keyword arguments
min::Union{Float64,Vector{Float64}}max::Union{Float64,Vector{Float64}}
ModelCalibration.Scaling — Type
Scaling(y::ScalePar,theta::ScalePar,x::ScalePar)Structure containing scaling information for the response variable, y, and the unknown model parameters, θ.
Keyword arguments
y::ScaleParScaling data for y.theta::ScaleParScaling data for theta.x::ScaleParScaling data for x.
ModelCalibration.SimStr — Type
SimStr(x::Array{Float64},y::Vector{Float64},theta::Array{Float64},x_reps::Array{Float64},
y_reps::Vector{Float64},theta_reps::Array{Float64})Structure containing the data from the computer simulation, organized for building a surrogate model.
Keyword arguments
x::Array{Float64}Array containing independent control variable settings for the simulation data, of dimensions n and nx.y::Array{Float64}Array containing the response variable outputs for the simulation data, of dimensions n and m.theta::Array{Float64}Array containing the independent unknown variables for the simulation data, of dimensions m and ntheta.x_reps::Array{Float64}Array containing independent control variable settings for the simulation data, of dimensions n*m and nx.y_reps::Vector{Float64}Vector containing the response variable outputs for the simulation data, of length n*m.theta_reps::Array{Float64}Array containing the independent unknown variables for the simulation data, of dimensions n*m and ntheta.
ModelCalibration.StepSize — Type
StepSize(theta::Vector{Float64},rho::Vector{Float64})Data structure containing the calculated optimal step sizes for θ and ρ for the Metropolis-Hastings algorithm
Keyword arguments
theta::Vector{Float64}A Vector of length m containin the optimal step sizes for each of the m θ for use in the Metropolis-Hastings algorithm.rho::Vector{Float64}A Vector of length p containing the optimal step sizes for each of the p ρ for use in the Metropolis-Hastings algorithm.
ModelCalibration.UpdatedVars — Type
UpdatedVars(theta::Vector{Float64},delta::Vector{Float64},sig2::Float64,tau2::Float64,rho::Vector{Float64})Data structure containing the most recently sampled values for each parameter during the Markov Chain Monte Carlo simulation sampling of the posterior distribution in the Bayesian model calibration.
Keyword arguments
theta::Vector{Float64}A Vector of length m containing the most recently sampled values of each of the m θ parameters.delta::Vector{Float64}A Vector of length q containing the most recently sampled values of δ.sig2::Float64The most recently sampled value of σ^2.tau2::Float64The most recently sampled value of τ^2.rho::Vector{Float64}A Vector of length p containing the most recently sampled values of each of the p ρ parameters.
Data Setup
ModelCalibration.format_data — Method
format_data(design::Array{Float64},simobs::Vector{Float64},expobs::Array{Float64},nx::Int64)Function to format raw data arrays supplied by design, simobs, and expobs into the requisatory structures for model calibration
Positional arguments
design::Array{Float64}An Array containing the input settings for both the control and unknown independent variables in the computer simulator. Dimenions n and p+m. The first p columns contain the control variables and the last m columns contain the unknown variables.simobs::Vector{Float64}A Vector containing the response of the computer simulator, corresponding to the inputs specified indesign. Length n.expobs::Array{Float64}An Array containing the experimental data to which the computer model is calibrated. Dimensions n and p+1. The first p columns contain the control variables and the last column contains the observations.nx::IntAn integer specifying the number of dimensions of the independent control variables
Returns
data::data_strThe data structure containing thesim_strandexp_strdata structures housing the computer simulator and experimental data, respectively.
ModelCalibration.format_prior_hyperparameters — Method
format_prior_hyperparameters(data::DataStr,alpha_sig2::Float64,beta_sig2::Float64,
alpha_tau2::Float64,beta_tau2::Float64,a_rho::Float64,b_rho::Float64,nx::Int64,ntheta::Int64)Funtion to initialize the specified prior distribution hyperparameters into the requisatory struct.
Positional arguments
data::DataStrStruct containing the computer simulator and experimental data.alpha_sig2::Float64Inverse Gamma shape parameter for the data error variance prior (σ^2).beta_sig2::Float64Inverse Gamma scale parameter for the data error variance prior (σ^2).alpha_tau2::Float64Inverse Gamma shape parameter for the discrepancy vairiance prior (τ^2).beta_tau2::Float64Inverse Gamma scale parameter for the discrepancy variance prior (τ^2).a_rho::Float64Beta shape parameter 1 for the discrepancy correlation prior (ρ).b_rho::Float64Beta shape parameter 2 for the discrepancy correlation prior (ρ).nx::IntInteger specifying the number of independent control variables (x).ntheta::IntInteger specifying the number of unknown computer model parameters (θ).
Returns
priors::PriorDataStruct containing the prior distribution hyperparameters for the variables in the model.
Details This function is agnostic to what prior distributions are used for the model but other functions may require the following prior distributions.
- θ ∼ U(A,B)
- τ^2 ∼ IG(α,β)
- σ^2 ∼ IG(α,β)
- ρ ∼ Beta(a,b)
ModelCalibration.normalize_data — Function
normalize_data(design_in::Array{Float64},simobs_in::Vector{Float64},
expobs_in::Union{Array{Float64},Float64},nx::Int64,nsim::Int64,scales::scaling,rev::Bool=false)Function to normalize data to the [0,1] interval or reverse the normalization back to the original data.
Positional arguments
design_in::Array{Float64}Matrix of input values for the computer simulator, of dimensions n and p+m. The first p columns correspond to control variables (x) and the last m correspond to unknown variables (θ).simobs_in::Vector{Float64}Vector of response values from the computer simulator, of length n. The rows must correspond to their appropriate input settings indesign.expobs_in::Union{Array{Float64},Float64}Matrix of experimental data, of dimensions v and p+1. The first p columns correspond the control independent variables (x) and the last column corresponds to the observed response.nx::Int64The number of independent control variables (x) in the experimental and computer simulator data.nsim::Int64The number of computer simulator data points.scales::ScalingData structure containing minimum and maximum values for the x, y, and θ variables for scaling.
Optional arguments
rev::BoolAn indicator of whether to normalize the data or reverse the normalization. Default value of false.- default value of false
Returns
design_out::Array{Float64}Thedesign_rawMatrix normalized to the relative Euclidean distance between the values specified inscales.simobs_out::Vector{Float64}Thesimobs_rawVector normalized to the relative Euclidean distance between the values specified inscales.expobs_out::Union{Array{Float64},Float64}Theexpobs_rawMatrix normalized to the relative Euclidean distance between the values specified inscales.
Details Concatenates all values for y from the computer simulator and experimental data. Concatenates all values for each dimension of x in the computer simulator and experimental data. Calls normalize_var or unnormalize_var on the concatenated y data, the concatenated x data in each dimension of x, and the computer simulator θ values for each dimension of θ.
ModelCalibration.normalize_var — Method
normalize_var(var::Array{Float64},scales::ScalePar)Function to scale a single variable's Array data to the relative distance between the minimum and maximum values specified by the scales structure. The function returns an Array, output, of equal size to var with its data scaled based on the minimum and maximum value described in values.
Positional arguments
var::Array{Float64}The array of field values to be scaled, with dimensions n and p.scales::ScaleParThe data structure containing the minimum and maximum values for scaling. The minimum and maximum values specified in this structure must be Vectors of length p.
∀ x ∈ var, y = (x-scales.min)/(scales.max-scales.min)
Returns
output::Array{Float64}An array containing the original field values,var, scaled to show the relative distance between the minimum and maximum values specified byscales.
ModelCalibration.pivot_data_wide — Method
pivot_data_wide(x::Array{Float64},y::Vector{Float64})Function to pivot multiple observations of the same n-length multivariate normal distribution into a wider array. Given there are m repeated observations of the same n-length multivariate normal distribution, with each repeated observation having the same independent variable settings, this function will reorganize the m*n length Array into a wider pivoted observation data Array, which is preferrable for likelihood calculations.
Positional arguments
x::Array{Float64}An Array of dimensions n*m and p, containing the settings of the p independent variables at each observational data pointy::Vector{Float64}A Vector of length n*m, containing the experimental observations aligning to the settings specified inx
Returns
x_unique::Array{Float64}An array of the unique settings of the independent control variables, dimensions n and py_wide::Array{Float64}An array of the observations organized by repetition, dimensions n and m
ModelCalibration.setup — Method
setup(design_raw::Array{Float64,2},simobs_raw::Vector{Float64},expobs_raw::Union{Array{Float64},
Float64},nx::Int,ntheta::Int,alpha_sig2::Float64,beta_sig2::Float64,alpha_tau2::Float64,
beta_tau2::Float64,a_rho::Float64,b_rho::Float64)Function to perform necessary calculation prior to calibration.
Positional arguments
design_raw::Array{Float64,2}Matrix of input values for the computer simulator, of dimensions n and p+m. The first p columns correspond to control variables (x) and the last m correspond to unknown variables (θ).simobs_raw::Vector{Float64}Vector of response values from the computer simulator, of length n. The rows must correspond to their appropriate input settings indesign.expobs_raw::Union{Array{Float64},Float64}Matrix of experimental data, of dimensions v and p+1. The first p columns correspond the control independent variables (x) and the last column corresponds to the observed response.nx::IntThe number of independent control variables (x) in the experimental and computer simulator data.ntheta::IntThe number of independent unknown variables (θ) in the computer simulator data.alpha_sig2::Float64Inverse Gamma shape parameter for the data error variance prior (σ^2).beta_sig2::Float64Inverse Gamma scale parameter for the data error variance prior (σ^2).alpha_tau2::Float64Inverse Gamma shape parameter for the discrepancy vairiance prior (τ^2).beta_tau2::Float64Inverse Gamma scale parameter for the discrepancy variance prior (τ^2).a_rho::Float64Beta shape parameter 1 for the discrepancy correlation prior (ρ).b_rho::Float64Beta shape parameter 2 for the discrepancy correlation prior (ρ).
Returns
nobs_tot::IntAn integer decsribing the total number of data points in the experimental data.nrep::IntAn integer describing the number of independent repeated observations of the same multivariate normal dsitribution data.nloc::IntAn integer describing the number of unique points in the multivariate normal distribution data.scales::ScalingA data structure describing the minimum and maximum values for the x, y, and θ variables.data::DataStrA data structure containing the normalized computer simulator and experimental data.priors::PriorDataA data structure containing the prior distribution hyperparameters.
ModelCalibration.unnormalize_var — Method
unnormalize_var(var::Array{Float64},scales::ScalePar)Function to un-normalize a normalized variable's Array data. This function takes data ∈ [0,1] and scales it based on the scales.
Positional arguments
var::Array{Float64}The array of field values to be scaled, with dimensions n and p.scales::ScaleParThe data structure containing the minimum and maximum values for scaling. The minimum and maximum values specified in this structure must be Vectors of length p.
∀ x ∈ var, y = (x-scales.min)/(scales.max-scales.min)
Returns
output::Array{Float64}An array containing the original field values,var, scaled to show the relative distance between the minimum and maximum values specified byscales.
Surrogate Model
ModelCalibration.predict_y_all — Method
predict_y_all(theta_settings::Vector{Float64},model)Function to get the default surrogate model output for a specified input setting.
Keyword arguments
theta_settings::Vector{Float64}Vector of θ input settings for prediction.modelSurrogate model.
Returns
responses:Vector{Float64}Vector of p responses of the surrogate model, for the p control variable settings on which it is trained.
ModelCalibration.surrogate_model — Method
surrogate_model(x::Array{Float64},theta::Array{Float64},y::Array{Float64},nx::Int,ntheta::Int)Function to generate the default surrogate model for calibration (a vector of Gaussian Processes, using the GaussianProcesses.jl package).
Keyword arguments
x::Array{Float64}Array of control independent variables in the computer model data set, dimensions q and p.theta::Array{Float64}Array of unknown independent variables in the computer model data set, dimensions n and m.y::Array{Float64}Array of responses from the computer model data set, dimensions n and q.nx::IntInteger indicating the number of independent control variables, p.ntheta::IntInteger indicating the number of unknown independent variables, m.
Returns
model::Vector{GPE}A Vector of length q whose elements areGPEmodels from theGaussianProcesses.jlpackage.
Details For a computer model data set where evaluated of n settings of theta, and at each setting of theta, is evaluated at q settings of x (producing an n by q Array of responses), this function creates a vector of q Gaussian process models. Each Gaussian process model is trained on the ith response at the ith setting of x, as a function of theta. Each model is trained on data scaled to the [0,1] interval and uses the following initial values for hyperparameters.
- zero-mean function.
- squared exponential covariance kernel with initial hyperparameters of 0.0 for all log length scales and log standard deviation.
- Prior distributions of N(0,1) for the log length scale and log standard deviation hyperparameters.
- Prior distribution of N(-2,1) for the log noise of the model (observational error).
ModelCalibration.train_model! — Method
train_model!(model)
train_model!(model;epochs::Int,make_plots::Bool,save_plots::Bool,show_plots::Bool,
mdl_apnd::String)Function to train the surrogate model with Bayesian inference via elliptical slice sampling.
Positional arguments
modelSurrogate model.
Keyword arguments
epochs::IntThe number of MCMC samples for training the model.- default value of 2500
make_plots::BoolIndicator of whether to make plots.- default value of true
save_plots::BoolIndicator of whether to save the plots.- default value of true
show_plots::BoolIndicator of whether to show the plots.- default value of true
mdl_apnd::StringString to append to the front of the generated plots' file names.- default value of ""
Optimization
ModelCalibration.get_mle — Method
get_mle(data::DataStr,nx::Int,nloc::Int,ntheta::Int,model;epochs::Int=7000)Wrapper function to find the MLE of θ and σ^2.
Positional arguments
data::DataStrStruct containing the computer simulator and experimental data.nx::IntThe number of control independent variables.nloc::IntThe number of locations at which the MVN data model is observed.ntheta::IntThe number of unknown independent variables.modelSurrogate model.
Keyword arguments
epochs::IntThe number of epochs to run for the opimization.- default value of 7000.
Returns
theta_mle::Vector{Float64}MLE for θ.covar::Array{Float64,2}MLE of the variance parameter for an identity-based covariance matrix.
ModelCalibration.make_covar — Method
make_covar(sig2::Float64,nloc::Int)Simple function to generate a covariance matrix. This dispatch (passed only a variance parameter and size of the matrix) will use the σ^2I form.
Positional arguments
sig2::Float64Variance parameter.nloc::IntSize of the square matrix.
Returns
covar::Array{Float64,2}The covariance matrix.
ModelCalibration.make_covar — Method
make_covar(params::CovarPars,nobs::Int)Simple function to generate a covariance matrix. This dispatch (passed CovarPars struct) will use a form with an integrated discrepancy.
Keyword arguments
params::CovarParsStruct containing covariance matrix parameters for integrated discrepancy.nobs::IntSize of the square matrix.
Returns
covar::Array{Float64,2}The covariance matrix.
ModelCalibration.max_lik_covar — Function
max_lik_covar(nx::Int,nloc::Int,data::DataStr,epochs::Int=7000)Function to get the maximum likelihood values of the hyperparameters for the data model covariance matrix. For a data model case where the discrepancy term (δ) is integrated out.
Positional arguments
nx::IntThe number of x variables.nloc::IntThe number of locations at which the MVN data model is observed.data::DataStrStruct containing the computer simulator and experimental data.epochs::IntThe number of optimization epochs.
Returns
covar_par_mle::Vector{Float64}The MLE values of the covariance matrix hyperparameters.
ModelCalibration.max_lik_sigma — Function
max_lik_sigma(opt_response::Vector{Float64},epochs::Int=7000)Function to get the maximum likelihood value for the data model error variance, σ.
Positional arguments
opt_response::Vector{Float64}Vector containing the surrogate model prediction at the MLE of θ.data::DataStrStruct containing the computer simulator and experimental data.epochs::IntNumber of optimization epochs.
Returns
sig_mle::Float64The maximum likelihood estimate the standard deviation, whose square when multiplied by the identity matrix, gives the covariance matrix for the data model.
ModelCalibration.max_lik_theta — Function
max_lik_theta(ntheta::Int,model,data::DataStr,epochs::Int=7000)Function to find the MLE of θ.
Positional arguments
ntheta::IntThe number of dimensions of θ.modelSurrogate model.data::DataStrStruct containing the computer simulator and experimental data.epochs::IntThe number of optimization epochs. Default value of 7000.
Returns
theta_mle::Vector{Float64}A Vector containing the MLE for θ.
Details This function calls the BlackBoxOptim.jl differential evolutionary optimizer on theta_opt, and returns the best candidate from the optimization.
Prior Distributions
ModelCalibration.log_prior_delta — Method
log_prior_delta(data::DataStr,delta::Vector{Float64},rho::Vector{Float64},
tau2::Float64nx::Int64,nloc::Int64)Function to evaluate the probability density function of the discrepancy term (δ) prior distribution. This implementation is for a case where the correlation matrix is not yet calculated.
Positional arguments
data::DataStrStruct containing the experimental and computer simulator data.delta::Vector{Float64}The value of delta at which to evaluate the distribution.rho::Vector{Float64}A Vector of length p containing the ρ values for evaluating the prior distribution density function.tau2::Float64The variance of the discrepancy function's covariance matrix.nx::Int64The number of x variables in the model.nloc::Int64The length of the data model (multivariate normal distribution) for a single independent observation.
Note that rho are supplied separately from the other variables contained in vars to allow evaluation of the likelihood at different values of ρ without requiring altering the vars struct during Matropolis-Hastings updates.
Returns
log_pdf_valThe log evaluation of the discrepancy term (δ) prior distribution density function.
Details The discrepancy term (δ) assumes a zero mean prior distribution with a covariance structure defined by Σ=τ^2C. C is the correlation structure. It is a size n square matrix with each element calculated by the following: C(x,x') = ∏(ρ^[4(x-x')]) The δ prior distribution density is evaluated by MVN(0,Σ)
ModelCalibration.log_prior_delta — Method
log_prior_delta(delta::Vector{Float64},corr::Array{Float64,2},tau2::Float64)Function to evaluate the probability density function of the discrepancy term (δ) prior distribution. This implementation is for a case where the correlation matrix is already calculated.
Positional arguments
delta::Vector{Float64}The value of delta at which to evaluate the distribution.corr::Array{Float64,2}Discrepancy function correlation matrix.tau2::Float64The variance of the discrepancy function's covariance matrix.
Returns
log_pdf_valThe log evaluation of the discrepancy term (δ) prior distribution density function.
Details The discrepancy term (δ) assumes a zero mean prior distribution with a covariance structure defined by Σ=τ^2C. C is the correlation structure. It is a size n square matrix with each element calculated by the following: C(x,x') = ∏(ρ^[4(x-x')]) The δ prior distribution density is evaluated by MVN(0,Σ)
ModelCalibration.prior_theta — Method
prior_theta(prior_data::PriorData,vars::UpdatedVars)This function evaluates the probability density function of the prior distribution on θ. Given that θ is modeled to have a uniform prior distribution, this function returns the same value for any value of θ. Generally, this function is not required for evaluation in a posterior sampling scheme.
Positional arguments
prior_data::PriorDataData structure containing the prior distribution hyperparameters for all variablesvars::UpdatedVarsData structure containing the most recently sampled values of all variables in the MCMC sampling scheme.
Returns
pdf_valA scalar Float giving the value of the θ prior distribution.
Details Given that θ are all modeled to have uniform prior distributions, this function evaluates to 1/(B-A) where B and A are the upper and lower bounds for the uniform distribution, respectively.
Likelihood
ModelCalibration.lik — Method
lik(data::DataStr,eta::Float64,sig2::Float64)Function to evaluate the data model's likelihood function. Implementation for a univariate normal distribution data model where the surrogate model's estimate is already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.eta::Float64Vector of theta sample values.sig2::Float64Data model error variance sample.
Returns
likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a univariate normal distribution with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The likelihood is calculated following: L(θ,σ^2|y)=∏^m [N(η,σ)]
ModelCalibration.lik — Method
lik(data::DataStr,theta::Vector{Float64},sig2::Float64,model)Function to evaluate the data model's likelihood function. Implementation for a univariate normal distribution data model where the surrogate model's estimate is not already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.theta::Vector{Float64}Vector of theta sample values.sig2::Float64Data model error variance sample.modelSurrogate model.
Returns
likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a univariate normal distribution with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The likelihood is calculated following: L(θ,σ^2|y)=∏^m [N(η,σ)] In this implementation, the surrogate model prediction is calculated in this function.
ModelCalibration.lik — Method
lik(data::DataStr,delta::Vector{Float64},sig2::Float64,eta::Vector{Float64})Function to evaluate the data model's likelihood function. Implementation for a multivariate normal distribution data model where the surrogate model's estimate is already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.delta::Vector{Float64}Vector of discrepancy function sample.sig2::Float64Data model error variance sample.eta::Vector{Float64}Surrogate model prediction
Returns
likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a multivariate normal distribution (having length n) with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The likelihood is calculated following: L(θ,σ^2,δ|y)=∏^m [MVN(η+δ,σ^2*I)]
ModelCalibration.lik — Method
lik(data::DataStr,theta::Vector{Float64},delta::Vector{Float64},sig2::Float64,model)Function to evaluate the data model's likelihood function. Implementation for a multivariate normal distribution data model where the surrogate model's estimate is not already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.theta::Vector{Float64}Vector of theta sample values.delta::Vector{Float64}Vector of discrepancy function sample.sig2::Float64Data model error variance sample.modelSurrogate model.
Returns
likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a multivariate normal distribution (having length n) with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The likelihood is calculated following: L(θ,σ^2,δ|y)=∏^m [MVN(η+δ,σ^2*I)] In this implementation, the surrogate model prediction is calculated in this function.
ModelCalibration.loglik — Method
loglik(data::DataStr,theta::Vector{Float64},sig2::Float64,model)Function to evaluate the data model's log likelihood function. Implementation for a univariate normal distribution data model where the surrogate model's estimate is already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.theta::Vector{Float64}Vector of theta sample values.sig2::Float64Data model error variance sample.modelSurrogate model.
Returns
log_likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a univariate normal distribution with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The log likelihood is calculated following: l(θ,σ^2|y)=∏^m [log(N(η,σ))]
ModelCalibration.loglik — Method
loglik(data::DataStr,theta::Vector{Float64},sig2::Float64,model)Function to evaluate the data model's log likelihood function. Implementation for a univariate normal distribution data model where the surrogate model's estimate is not already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.theta::Vector{Float64}Vector of theta sample values.sig2::Float64Data model error variance sample.modelSurrogate model.
Returns
log_likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a univariate normal distribution with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The log likelihood is calculated following: l(θ,σ^2|y)=∏^m [log(N(η,σ))] In this implementation, the surrogate model prediction is calculated in this function.
ModelCalibration.loglik — Method
log_lik(data::DataStr,delta::Vector{Float64},sig2::Float64,eta::Vector{Float64})Function to evaluate the data model's log likelihood function. Implementation for a multivariate normal distribution data model where the surrogate model's estimate is already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.delta::Vector{Float64}Vector of discrepancy function sample.sig2::Float64Data model error variance sample.eta::Vector{Float64}Surrogate model estimate.
Returns
log_likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a multivariate normal distribution (having length n) with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The likelihood is calculated following: l(θ,σ^2,δ|y)=Σ^m [log(MVN(η+δ,τ^2*I))]
ModelCalibration.loglik — Method
loglik(data::DataStr,theta::Vector{Float64},delta::Vector{Float64},sig2::Float64,model)Function to evaluate the data model's log likelihood function. Implementation for a multivariate normal distribution data model where the surrogate model's estimate is not already known.
Positional arguments
data::DataStrA data structure containing the computer simulator and experimental data.theta::Vector{Float64}Vector of theta sample values.delta::Vector{Float64}Vector of discrepancy function sample.sig2::Float64Data model error variance sample.modelSurrogate model.
Returns
log_likelihoodA scalar Float64 value of the likelihood function.
Details The likelihood function is evaluated as the product of probability density function of the data model over each independent observation. This likelihood calculation assumes a multivariate normal distribution (having length n) with m independent observations. Let η be the surrogate model's prediction of the response variabeles, y, for the given θ values specified in theta. The log likelihood is calculated following: l(θ,σ^2,δ|y)=Σ^m [log(MVN(η+δ,τ^2*I))] In this implementation, the surrogate model prediction is calculated in this function.
Gaussian Process Kernel
ModelCalibration.correlation_construct — Method
correlation_construct(rho::Vector{Float64},x::Array{Float64,2},nx::Int64,nobs::Int64)Function to construct the correlation Matrix for a set of x locations.
Positional arguments
rho::Vector{Float64}Vector of correlation parameters (ρ) across the different dimensions of x, length nx.x::Array{Float64,2}Array of x locations for calculating the correlation Matrix, dimensions nobs and nx.nx::Int64The number of x dimensions.nobs::Int64The number of data points for calculating the correlation Matrix.
Returns
correlation::Array{Float64,2}The correlation matrix of x, given ρ.
Details An nobs by nobs Matrix is initialized and, at each [i,j] index in the matrix, correlation_kernel is called to calculate the correlation given ρ, x[i,:], and x[j,:]. The square root of the machine precision for a Float64 is added to the diagonal elements of the Matrix for stability purposes.
ModelCalibration.correlation_kernel — Method
correlation_kernel(x1::Vector{Float64},x2::Vector{Float64},rho::Vector{Float64},nx::Int64)Function to calculate the correlation value between two locations, x1 and x2, given the correlation parameters, rho.
Positional arguments
x1::Vector{Float64}Vector of settings at the first location, length nx.x2::Vector{Float64}Vector of settings at the second location, length nx.rho::Vector{Float64}Vector of correlation parameters (ρ) across the different dimensions of x, length nx.nx::Int64Integer specifying the number of x dimensions.
Returns
correlation::Float64A float describing the correlation between the two locationsx1andx2givenrho.
Details Correlation is calculated as ∏[ρ^(4(x1-x2)^2)], where the product is taken over the number of x dimensions.
Initialization
ModelCalibration.init_vars — Method
init_vars(nmcmc::Int)Function to initialize structure to store samples for discrete domain griddy Gibbs MCMC sampling. Implementation for griddy Gibbs sampling scheme.
Positional arguments:
nmcmc::IntInteger specifying the number of MCMC samples.
Returns
::GriddyVarsStructData structure containing initialized Arrays to store the sampled values for each variable in the model.
ModelCalibration.init_vars — Method
init_vars(data::DataStr,nmcmc::Int,nx::Int,ntheta::Int,theta_init::Vector{Float64})Function to initialize structure to store samples for continuous domain MCMC sampling. Implementation for continuous sampling scheme.
Positional arguments:
data::DataStrStrcture containing computer simulator and experimental data.nmcmc::IntInteger specifying the number of MCMC samples.nx::IntInteger specifying the number of independent control variables (x).ntheta::IntInteger specifying the number of unknown computer model variabels (θ).theta_init::Vector{Float64}Vector of lengthnthetaspecifying the values at which to initialize the θ variables for MCMC.
Returns
::BulkVarsStructData structure containing initialized Arrays to store the sampled values for each variable in the model.
Results Processing
ModelCalibration.get_estimates — Method
get_estimates(data::Vector{Float64})Function to get the mean, median, and 95% credible bounds of a set of posterior samples.
Positional arguments
data::Vector{Float64}
Returns
temp::Vector{Float64}Vector containing the estimates.
ModelCalibration.make_estimate_table — Method
make_estimate_table(samples::BulkVarsStruct,nx::Int,ntheta::Int,mdl_apnd::String)Function to make the table of estimates from the posterior samples.
Positional arguments
samples::BulkVarsStructstruct containing the posterior samples from the continuous sampler.nx::Intnumber of x variables.ntheta::Intnumber of theta variables.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.make_estimate_table — Method
make_estimate_table!(samples::GriddyPosteriors,nx::Int,ntheta::Int,mdl_apnd::String)Function to make the table of estimates from the posterior samples.
Positional arguments
samples::GriddyPosteriorsstruct containing the posterior samples from the griddy Gibbs sampler.nx::Intnumber of x variables.ntheta::Intnumber of theta variables.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.normalize_samples — Function
normalize_samples(samples::BulkVarsStruct,scales::Scaling)
normalize_samples(samples::BulkVarsStruct,scales::Scaling,rev::Bool)Function to normalize or reverse the normalization of the posterior samples. This is the implementation for the continuous sampler results.
Positional arguments
samples::BulkVarsStructStruct containing the posterior samples.scales::ScalingStruct containing the minimum and maximum values for each variables.
Optional arguments
rev::BoolIndicator of whether to reverse the normalization or not.- default value of true.
ModelCalibration.normalize_samples — Function
normalize_samples(samples::GriddyVarsStruct,scales::Scaling,theta_grid::Array{Float64},
sig_grid::Union{Nothing,Array{Float64}})
normalize_samples(samples::GriddyVarsStruct,scales::Scaling,theta_grid::Array{Float64},
sig_grid::Union{Nothing,Array{Float64}},rev::Bool)Function to normalize or reverse the normalization of the posterior samples. This implementation is for the griddy Gibbs sampler.
Positional arguments
samples::GriddyVarsStructStruct containing the posterior samples (in index form) from the griddy Gibbs sampler.scales::ScalingStruct containing the minimum and maximum values for each variables.theta_grid::Array{Float64}Array containing the sampling grid for θ that was used for the griddy Gibbs sampler.sig_grid::Union{Nothing,Array{Float64}}Array containing the sampling grid for the proportional covariance matrix used for the griddy Gibbs sampler.
Optional arguments
rev::BoolIndicator of whether to reverse the normalization or not.- default value of true.
Returns
converted_samples::GriddyPosteriorsA struct containing the real value samples from the griddy Gibbs sampler.
ModelCalibration.plot_correlation — Method
plot_correlation(data::Array{Float64,2},var::String,save_plots::Bool,show_plots::Bool,
mdl_apnd::String)Function to generate a correlation plot for the samples of a multidimensional variable. Optionally, display and/or save the plot.
Positional arguments
data::Array{Float64,2}Data to plot.var::StringName of the variable being plotted.save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.plot_credible_bounds — Method
plot_credible_bounds(data::Array{Float64},x_coords::Array{Float64},scales::ScalePar)Function to generate a plot of a function over the x coordinates of the data along with its 95% credible bounds.
Positional arguments
data::Array{Float64}Function's data to plot.x_coords::Array{Float64}the x coordinates of the data.scales::ScaleParStruct containing the minimum and maximum value of the variable indata.
Returns
pThe generated plot.
ModelCalibration.plot_disc! — Method
plot_disc!(delta::Array{Float64},x_coords::Array{Float64},scales::Scaling,
show_plots::Bool,save_plots::Bool,mdl_apnd::String)Function to generate plots for the discrepancy function. This implementation does not generate a histogram or trace plot.
Positional arguments
delta::Array{Float64}Array containing the posterior samples of the discrepancy function, each row of the Matrix is a sample of δ.x_coords::Array{Float64}Array containing the x coordinates from the experimental data.scales::ScalingStruct containing scaling information for the variables in the data.save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.plot_disc! — Method
plot_disc!(delta::Array{Float64},x_coords::Array{Float64},scales::Scaling,nbins::Int,
show_plots::Bool,save_plots::Bool,mdl_apnd::String)Function to generate plots for the discrepancy function. This implementation generates a histogram and a trace plot.
Positional arguments
delta::Array{Float64}Array containing the posterior samples of the discrepancy function, each row of the Matrix is a sample of δ.x_coords::Array{Float64}Array containing the x coordinates from the experimental data.scales::ScalingStruct containing scaling information for the variables in the data.nbins::IntThe number of bins to use for the histograms.save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.plot_prediction! — Method
plot_prediction!(samples::BulkVarsStruct,data::DataStr,scales::Scaling,
save_plots::Bool,show_plots::Bool,mdl_apnd::String)Function to plot the surrogate model and data model estimations.
Positional arguments
samples::BulkVarsStructStruct containing non-normalized posterior samples.data::DataStrStruct containing the computer simulator and experimental data.scales::ScalingStruct containing the minimum and maximum values for each variable.save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.plot_prediction! — Method
plot_prediction!(theta_idx::Vector{Int},samples::GriddyPosteriors,x_coords::Array{Float64},
grid_resp::Array{Float64,2},data::DataStr,scales::Scaling,save_plots::Bool,
show_plots::Bool,mdl_apnd::String)Function to plot the surrogate model and data model estimations.
Positional arguments
theta_idx::Vector{Int}Sampled indices of theta from the griddy Gibbs sampler.samples::GriddyPosteriorsStruct containing non-normalized posterior samples.grid_resp::Array{Float64,2}Matrix of grid responses.data::DataStrStruct containing the computer simulator and experimental data.scales::ScalingStruct containing the minimum and maximum values for each variable.save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.post_process — Method
post_process(samples::BulkVarsStruct,data::DataStr,nx::Int,ntheta::Int,nburn::Int,
scales::Scaling)
post_process(samples::BulkVarsStruct,data::DataStr,nx::Int,ntheta::Int,nburn::Int,
scales::Scaling;make_plots::Bool,save_plots::Bool,show_plots::Bool,
nbins::Int,nthin::Int,mdl_apnd::String)Wrapper function to post-process the posterior samples.
Positional arguments
samples::BulkVarsStructStruct containing the posterior samples.data::DataStrStruct containing the computer simulator and experimental data.nx::IntNumber of x dimensions.ntheta::Intnumber of θ dimensions.nburn::IntThe number of samples to burn.scales::ScalintStruct containing the scaling information for the data.
Keyword arguments
make_plots::BoolIndicator of whether to make plots.- default value of true
save_plots::BoolIndicator of whether to save the plots.- default value of true
show_plots::BoolIndicator of whether to show the plots.- default value of true
nthin::IntThe number of samples to skip when thinning.- default value of 5
nbins::IntThe number of bins to use for histograms.- default value of 30
mdl_apnd::StringString to append to the front of the generated plots' file names.- default value of ""
ModelCalibration.post_process — Method
post_process(samples::GriddyVarsStruct,data::DataStr,nx::Int,ntheta::Int,nburn::Int,
scales::Scaling,theta_grid::Array{Float64,2},sig_grid::Union{Nothing,Array{Float64,2}},
grid_resp::Array{Float64,2})
post_process(samples::GriddyVarsStruct,data::DataStr,nx::Int,ntheta::Int,nburn::Int,
scales::Scaling,theta_grid::Array{Float64,2},sig_grid::Union{Nothing,Array{Float64,2}},
grid_resp::Array{Float64,2};make_plots::Bool,save_plots::Bool,show_plots::Bool,
nbins::Int,nthin::Int,mdl_apnd::String)Wrapper function to post-process the posterior samples.
Positional arguments
samples::GriddyVarsStructStruct containing the posterior samples.data::DataStrStruct containing the computer simulator and experimental data.nx::IntNumber of x dimensions.ntheta::Intnumber of θ dimensions.nburn::IntThe number of samples to burn.scales::ScalintStruct containing the scaling information for the data.theta_grid::Array{Float64,2}Matrix of theta grid values.sig_grid::Union{Nothing,Array{Float64,2}}Matrix of integrated discrepancy covaraince grid values.grid_resp::Array{Float64,2}Responses of the surrogate model correspondingtheta_grid.
Keyword arguments
make_plots::BoolIndicator of whether to make plots.- default value of true
save_plots::BoolIndicator of whether to save the plots.- default value of true
show_plots::BoolIndicator of whether to show the plots.- default value of true
nthin::IntThe number of samples to skip when thinning.- default value of 5
nbins::IntThe number of bins to use for histograms.- default value of 30
mdl_apnd::StringString to append to the front of the generated plots' file names.- default value of ""
ModelCalibration.posterior_hist! — Method
posterior_hist!(data::Array{Float64},nbins::Int,var::String,iter::Int,save_plots::Bool,
show_plots::Bool,mdl_apnd::String)Function to generate a combined posterior histogram and kernel density plot for the posterior samples of a variable. Optionally, display and/or save the plot.
Positional arguments
data::Array{Float64}Array of posterior samples to plot.nbins::IntThe number of bins to use for the histogram.var::StringA string specifying the name of the variable being plotted.iter::IntAn Integer specifying the iterate of a multidimensional variable, e.g. θ.- for a univariate variable, e.g. τ^2, specify 0.
save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.
ModelCalibration.remove_burn — Method
remove_burn(samples::BulkVarsStruct,nburn::Int)Function to extract the posterior samples after the burned values. Implementation for the continuous sampler results.
Positional arguments
samples::BulkVarsStructStruct containing the posterior samples from the continuous sampler.nburn::IntThe number of samples to discard
Returns
truncated::BulkVarsStructBulk vars struct that contains the samples retained after discarding the burned samples.
Details This selects all posterior samples from nburn + 1 through the end of the samples. These values are retained and placed into a new posterior samples struct, which is then returned.
ModelCalibration.remove_burn — Method
remove_burn(samples::GriddyPosteriors,nburn::Int)Function to extract the posterior samples after the burned values. Implementation for the griddy Gibbs sampler results.
Positional arguments
samples::GriddyPosteriorsStruct containing the posterior samples from the griddy Gibbs sampler.nburn::IntThe number of samples to discard
Returns
truncated::GriddyPosteriorsBulk vars struct that contains the samples retained after discarding the burned samples.
Details This selects all posterior samples from nburn + 1 through the end of the samples. These values are retained and placed into a new posterior samples struct, which is then returned.
ModelCalibration.remove_burn — Method
remove_burn(samples::GriddyVarsStruct,nburn::Int)Function to extract the posterior samples after the burned values. Implementation for the griddy Gibbs sampler results, still in index form.
Positional arguments
samples::GriddyVarsStructStruct containing the posterior samples from the griddy Gibbs sampler.nburn::IntThe number of samples to discard
Returns
truncated::GriddyVarsStructBulk vars struct that contains the samples retained after discarding the burned samples.
Details This selects all posterior samples from nburn + 1 through the end of the samples. These values are retained and placed into a new posterior samples struct, which is then returned.
ModelCalibration.sqrt_variance! — Method
sqrt_variance(samples::BulkVarsStruct)Function to take the square root of the posterior samples of the variance parameters, making them standard deviations. This implementation is for the continuous sampler posterior samples.
Positional arguments
samples::BulkVarsStructPosterior samples from the continuous sampler.
ModelCalibration.sqrt_variance! — Method
sqrt_variance(samples::GriddyPosteriors)Function to take the square root of the posterior samples of the variance parameters, making them standard deviations. This implementation is for the griddy Gibbs sampler posterior samples.
Keyword arguments
samples::GriddyPosteriorsPosterior samples from the griddy Gibbs sampler.
ModelCalibration.thin_samples — Method
thin_samples(samples::BulkVarsStruct,nthin::Int)Function to thin the posterior samples, helping remove autocorrelated values from the samples. This implementation is for the continuous sampler results.
Positional arguments
samples::BulkVarsStructStruct storing the posterior samples.nthin::IntThe number of samples to skip.
Returns
thinned::BulkVarsStructStruct containing the thinned posterior samples.
Details This function selects retains every nthinth sample from the posterior samples, starting at the first index and going through to the end.
ModelCalibration.thin_samples — Method
thin_samples(samples::GriddyPosteriors,nthin::Int)Function to thin the posterior samples, helping remove autocorrelated values from the samples. This implementation is for the griddy Gibbs sampler results.
Positional arguments
samples::GriddyPosteriorsStruct storing the posterior samples.nthin::IntThe number of samples to skip.
Returns
thinned::GriddyPosteriorsStruct containing the thinned posterior samples.
Details This function selects retains every nthinth sample from the posterior samples, starting at the first index and going through to the end.
ModelCalibration.thin_samples — Method
thin_samples(samples::GriddyVarsStruct,nthin::Int)Function to thin the posterior samples, helping remove autocorrelated values from the samples. This implementation is for the griddy Gibbs sampler, with the results still in index form.
Positional arguments
samples::GriddyVarsStructStruct storing the posterior samples.nthin::IntThe number of samples to skip.
Returns
thinned::GriddyVarsStructStruct containing the thinned posterior samples.
Details This function selects retains every nthinth sample from the posterior samples, starting at the first index and going through to the end.
ModelCalibration.trace_plot! — Method
trace_plot!(data::Array{Float64},var::String,iter::Int,save_plots::Bool,
show_plots::Bool,mdl_apnd::String)Function to generate a combined posterior histogram and kernel density plot for the posterior samples of a variable. Optionally, display and/or save the plot.
Positional arguments
data::Array{Float64}Array of posterior samples to plot.var::StringA string specifying the name of the variable being plotted.iter::IntAn Integer specifying the iterate of a multidimensional variable, e.g. θ.- for a univariate variable, e.g. τ^2, specify 0.
save_plots::BoolIndicator of whether to save the plot that is generated.show_plots::BoolIndicator of whether to display the plot that is generated.mdl_apnd::StringString to append to the front of the saved plot's file name.