R/Meth.sim.R
Meth.sim.RdSimulates a dataframe representing data from a method comparison study. It
is returned as a Meth object.
The number of items (patient, animal, sample, unit etc.)
The number of methods of measurement.
The (maximal) number of replicate measurements for each (item,method) pair.
The minimal number of replicate measurements for each
(item,method) pair. If nr<Nr, the number of replicates for each
(meth,item) pair is uniformly distributed on the points nr:Nr,
otherwise nr is ignored. Different number of replicates is only
meaningful if replicates are not linked, hence nr is also ignored
when sigma.ir>0.
A vector of method-specific intercepts for the linear equation relating the "true" underlying item mean measurement to the mean measurement on each method.
A vector of method-specific slopes for the linear equation relating the "true" underlying item mean measurement to the mean measurement on each method.
The range across items of the "true" mean measurement. Item
means are uniformly spaced across the range. If a vector length Ni
is given, the values of that vector will be used as "true" means.
A vector of method-specific standard deviations for a method by item random effect. Some or all components can be zero.
Method-specific standard deviations for the item by replicate random effect.
A vector of method-specific residual standard deviations for a method by item by replicate random effect (residual variation). All components must be greater than zero.
Fraction of the observations from each method to keep.
Fraction of the observations from each item to keep. If both
m.thin and i.thin are given the thinning is by their
componentwise product.
A Meth object, i.e. dataframe with columns
meth, item, repl and y, representing results
from a method comparison study.
Data are simulated according to the following model for an observation
\(y_{mir}\): $$y_{mir} = \alpha_m + \beta_m(\mu_i+b_{ir} +
c_{mi}) + e_{mir}$$ where
\(b_{ir}\) is a random item by repl interaction (with
standard deviation for method \(m\) the corresponding component of the
vector \(\sigma_ir\)), \(c_{mi}\) is a random
meth by item interaction (with standard deviation for method
\(m\) the corresponding component of the vector \(\sigma_mi\))
and \(e_{mir}\) is a residual error term (with standard deviation
for method \(m\) the corresponding component of the vector
\(\sigma_mir\)). The \(\mu_i\)'s are uniformly spaced
in a range specified by mu.range.
Meth.sim( Ni=4, Nr=3 )
xx <- Meth.sim( Nm=3, Nr=5, nr=2, alpha=1:3, beta=c(0.7,0.9,1.2), m.thin=0.7 )
summary( xx )
#> #Replicates
#> Method 1 2 3 4 5 #Items #Obs: 1040 Values: min med max
#> 1 2 14 31 32 21 100 356 -15.609748 34.97557 84.29873
#> 2 4 16 28 35 17 100 345 -6.933551 46.86464 100.62993
#> 3 1 20 31 35 13 100 339 -15.230222 67.02680 140.47183
plot( xx )