This function takes in the mixture data, food source means and standard
deviations, and (optionally) correction factor means and standard
deviations, and concentration proportions. It performs some (non-exhaustive)
checking of the data to make sure it will run through simmr. It outputs an
object of class cosimmr_input
.
cosimmr_load(
formula,
source_names,
source_means,
source_sds,
correction_means = NULL,
correction_sds = NULL,
concentration_means = NULL,
scale_x = TRUE
)
Formula giving in form y ~ x where y is a vector or matrix of mixture values and x is a vector or matrix of covariates
The names of the sources given as a character string
The means of the source values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers
The standard deviations of the source values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers
The means of the correction values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. If not provided these are set to 0.
The standard deviations of the correction values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. If not provided these are set to 0.
The means of the concentration values, given as a matrix where the number of rows is the number of sources and the number of columns is the number of tracers. These should be between 0 and 1. If not provided these are all set to 1.
Whether or not you wish to scale the x values provided, or run the model using the original x values. Defaults to TRUE.
An object of class cosimmr_input
with the following elements:
The mixture data
Source means
Source standard deviations
Correction means
Correction standard deviations
Concentration dependence means
The number of observations
The number of tracers/isotopes
The number of sources
The number of groups
For standard stable isotope mixture modelling, the mixture matrix will
contain a row for each individual and a column for each isotopic value.
cosimmr
will allow for any number of isotopes and any number of
observations, within computational limits. The source means/sds should be
provided for each food source on each isotope. The correction means (usually
trophic enrichment factors) can be set as zero if required, and should be of
the same shape as the source values. The concentration dependence means
should be estimated values of the proportion of each element in the food
source in question and should be given in proportion format between 0 and 1.
At present there is no means to include concentration standard deviations.
See cosimmr_ffvb
for complete examples.
# \donttest{
# A simple example with 10 observations, 2 tracers and 4 sources
data(geese_data_day1)
simmr_1 <- with(
geese_data_day1,
cosimmr_load(
formula = mixtures ~ 1,
source_names = source_names,
source_means = source_means,
source_sds = source_sds,
correction_means = correction_means,
correction_sds = correction_sds,
concentration_means = concentration_means,
scale_x = TRUE
)
)
#> Cannot scale when using mixtures ~1
print(simmr_1)
#> $mixtures
#> d13C_Pl d15N_Pl
#> [1,] -11.36 10.22
#> [2,] -11.88 10.37
#> [3,] -10.60 10.44
#> [4,] -11.25 10.52
#> [5,] -11.66 10.19
#> [6,] -10.41 10.45
#> [7,] -10.88 9.91
#> [8,] -14.73 11.27
#> [9,] -11.52 9.34
#>
#> $x_scaled
#> (Intercept)
#> 1 1
#> 2 1
#> 3 1
#> 4 1
#> 5 1
#> 6 1
#> 7 1
#> 8 1
#> 9 1
#> attr(,"assign")
#> [1] 0
#>
#> $source_names
#> [1] "Zostera" "Grass" "U.lactuca" "Enteromorpha"
#>
#> $source_means
#> meand13CPl meand15NPl
#> [1,] -11.17023 6.488984
#> [2,] -30.87984 4.432160
#> [3,] -11.17090 11.192613
#> [4,] -14.05701 9.816280
#>
#> $source_sds
#> SDd13C SDd15N
#> [1,] 1.2149562 1.459463
#> [2,] 0.6413182 2.268071
#> [3,] 1.9593306 1.112438
#> [4,] 1.1724677 0.827104
#>
#> $correction_means
#> meand13CPl meand15NPl
#> [1,] 1.63 3.54
#> [2,] 1.63 3.54
#> [3,] 1.63 3.54
#> [4,] 1.63 3.54
#>
#> $correction_sds
#> SDd13C SDd15N
#> [1,] 0.63 0.74
#> [2,] 0.63 0.74
#> [3,] 0.63 0.74
#> [4,] 0.63 0.74
#>
#> $concentration_means
#> d13CPl d15NPl
#> [1,] 0.3593 0.0297
#> [2,] 0.4026 0.0355
#> [3,] 0.2098 0.0192
#> [4,] 0.1844 0.0139
#>
#> $n_obs
#> [1] 9
#>
#> $n_tracers
#> [1] 2
#>
#> $n_sources
#> [1] 4
#>
#> $scale_x
#> [1] TRUE
#>
#> $scaled_center
#> NULL
#>
#> $scaled_scale
#> NULL
#>
#> $intercept
#> [1] TRUE
#>
#> $covariates_df
#> data frame with 0 columns and 9 rows
#>
#> $n_covariates
#> [1] 1
#>
#> $original_x
#> (Intercept)
#> 1 1
#> 2 1
#> 3 1
#> 4 1
#> 5 1
#> 6 1
#> 7 1
#> 8 1
#> 9 1
#> attr(,"assign")
#> [1] 0
#>
#> attr(,"class")
#> [1] "cosimmr_input"
# }