This simple function will weight ERA observations based on replicates (Reps column) and the number of observations contributed by a study (N.Obs.Study) within combinations of the grouping variables specified.

ERAWeight(Data, Grouping.Cols)

Arguments

Data

An ERA data.table containing columns Reps and Code.

Grouping.Cols

A vector of columns names; these are grouping variables and weightings are calculated for each combination of their values. Default = NA.

Value

ERAWeights returns the input data.table with two appended columns:

  • N.Obs.Study = the number of observations contributed by a study (i.e., Code) within combinations of the grouping variables specified.

  • Weight.Study = a numeric weighting.

Details

For each observations weightings are calculated using the formula (Rep^2/(2*Rep))/N.Obs.Study where Rep is the number of experimental replicates and N.Obs.Study is the number of observations contributed from the observation's study for the grouping variables provided.