nondecreasing_length_sampler {Xcertainty} | R Documentation |
MCMC sampler for measurements of individuals with replicates but no age information.
Description
Build an MCMC sampler that uses calibration data to estimate measurements that are assumed to be non-decreasing in time. This sampler is well suited for when individuals have replicate measurements across time points but do not have age information. The model estimates changes in unique combinations of Subject/Measurement pairs over Timepoints.
Usage
nondecreasing_length_sampler(data, priors, package_only = FALSE)
Arguments
data |
Photogrammetric data formatted for Xcertainty models, required to
be an object with class |
priors |
|
package_only |
|
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
Examples
# load example wide-format data
data("calibration")
data("whales")
data("whale_info")
# 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'
)
# parse field study
whale_data = parse_observations(
x = whales,
subject_col = 'whale_ID',
meas_col = 'TL.pix',
image_col = 'Image',
barometer_col = 'AltitudeBarometer',
laser_col = 'AltitudeLaser',
flen_col = 'FocalLength',
iwidth_col = 'ImageWidth',
swidth_col = 'SensorWidth',
uas_col = 'UAS',
timepoint_col = 'year'
)
# build sampler
sampler_data = nondecreasing_length_sampler(
data = combine_observations(calibration_data, whale_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),
object_lengths = c(min = .01, max = 20)
),
# set to false to return sampler function
package_only = TRUE
)