Learn R Programming

Xcertainty (version 1.0.0)

calibration_sampler: MCMC sampler for calibration data

Description

Build an MCMC sampler that only uses calibration data to estimate measurement error parameters

Usage

calibration_sampler(data, priors, package_only = FALSE)

Value

outputs a function to run a sampler, the function arguments are:

niter

set the number of iterations

burn

set the number samples to discard

thin

set the thinning rate

Arguments

data

Photogrammetric data formatted for Xcertainty models, required to be an object with class obs.parsed, which can be obtained by running parse_observations()

priors

list with components that define the model's prior distribution. See help("flatten_data") for more details.

package_only

TRUE to return the formatted data used to build the sampler, otherwise FALSE to return the sampler

Examples

Run this code
# load example wide-format data
data("calibration")

# parse calibration study
calibration_data = parse_observations(
  x = calibration, 
  subject_col = 'CO.ID',
  meas_col = 'Lpix', 
  tlen_col = 'CO.L', 
  image_col = 'image', 
  barometer_col = 'Baro_Alt',
  laser_col = 'Laser_Alt', 
  flen_col = 'Focal_Length', 
  iwidth_col = 'Iw', 
  swidth_col = 'Sw',
  uas_col = 'uas'
)

# build sampler
sampler_data = calibration_sampler(
  data = calibration_data,
  priors = list(
    image_altitude = c(min = 0.1, max = 130),
    altimeter_bias = rbind(
      data.frame(altimeter = 'Barometer', mean = 0, sd = 1e2),
      data.frame(altimeter = 'Laser', mean = 0, sd = 1e2)
    ),
    altimeter_variance = rbind(
      data.frame(altimeter = 'Barometer', shape = .01, rate = .01),
      data.frame(altimeter = 'Laser', shape = .01, rate = .01)
    ),
    altimeter_scaling = rbind(
      data.frame(altimeter = 'Barometer', mean = 1, sd = 1e1),
      data.frame(altimeter = 'Laser', mean = 1, sd = 1e1)
    ),
    pixel_variance = c(shape = .01, rate = .01)
  ),
  # set to false to return sampler function
  package_only = TRUE
)

Run the code above in your browser using DataLab