| sim.measurements | R Documentation |
Simulates morphometric data from a photogrammetry survey, with observations subject to measurement error, under the model described by Stevenson, Smit, and Setyawan (2026).
sim.measurements(
n.animals = NULL,
n.photos = NULL,
data = NULL,
mus,
sigmas,
rhos,
psis,
phis,
log.transform = FALSE
)
n.animals |
Integer. The number of animals in the sample. |
n.photos |
Integer vector. If there are |
data |
A data frame with columns |
mus |
A vector with an element for each dimension, providing the means of the true dimension sizes in the population. |
sigmas |
A vector with an element for each dimension, providing the standard deviations for true dimension sizes in the population. |
rhos |
A vector, with one element for each pair of dimensions, providing the pairwise correlations between true dimension sizes in the population. See 'Details' for the correct order for the correlations. |
psis |
A vector with an element for each dimension, providing the standard deviations of measurement errors for the dimensions. |
phis |
A vector, with one element for each pair of dimensions, providing the pairwise correlations between measurement errors for the dimensions. See 'Details' for the correct order for the correlations. |
log.transform |
Logical. If |
For arguments rhos and phis, the elements must be
ordered so that all m - 1 correlations involving
dimension 1 appear first in ascending numerical order, followed
by all remaining m - 2 correlations involving dimension
2, and so on, where eqn{m} is the number of dimensions.
For example, if m = 4, then the first three elements are the
correlations between dimension 1 and dimensions 2, 3, and 4,
respectively. The following two elements are correlations between
dimension 2 and dimensions 3 and 4, respectively. The final element
is the correlation between dimension 3 and 4.
A data frame with four columns:
animal.idAn individual identification number. Rows
with the same animal.id correspond to
measurements of the same individual.
photo.idA photo identification number. Rows with
the same photo.id correspond to
measurements taken from the same image.
dimAn integer indicating the dimension the measurement is for.
measurementThe observed measurement value.
Stevenson, B. C., Smit, E., and Setyawan, E. (2026) Measurement error models for morphometric data. Annals of Applied Statistics, 20: 945–962.
sim.morph() to conduct a simulation study by
simulating multiple data sets and fitting a model to each one.
## Simulating data for ten animals, with two photos each, measuring
## three dimensions.
sim.data <- sim.measurements(n.animals = 10, n.photos = 2,
mus = c(315, 150, 100),
sigmas = c(25, 15, 10),
rhos = c(0.85, 0.80, 0.75),
psis = c(10, 6, 4),
phis = c(0.5, 0.4, 0.3))
head(sim.data)
## Simulating data for two animals, with different numbers of
## photos for each, and different measurements available from
## different photos.
data <- data.frame(animal.id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2),
photo.id = c(1, 1, 2, 2, 2, 1, 2, 3, 3, 4, 4),
dim = c(1, 3, 1, 2, 3, 1, 1, 1, 3, 2, 3))
sim.data <- sim.measurements(data = data,
mus = c(315, 150, 100),
sigmas = c(25, 15, 10),
rhos = c(0.85, 0.80, 0.75),
psis = c(10, 6, 4),
phis = c(0.5, 0.4, 0.3))
sim.data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.