PrepareStabData.Rd
This function prepares data for use with the StabCalc
function. It calculates relative, absolute and adjusted coefficients of yield variation
for unique temporal sequences of at least three years.
PrepareStabData(Data, OutCodes = 101)
a data.table
including fields of the data supplied, subset to unique temporal sequences with the following columns appended:
UID
integer, a unique identifier for a pairing of control and experimental treatments (CT and ET) and their outcome that is used to match observations across time.
UID.C
integer, a unique identifier for a CT that is used to match observations across time.
UID.T
integer, a unique identifier for an ET that is used to match observations across time.
yieldcont
numeric, the mean yield of the CT.
minyieldcont
numeric, the minimum yield of the CT.
yieldexp
numeric, the mean yield of the ET.
sdcont
numeric, the standard deviation of the CT.
varcont
numeric, the variance of the CT.
sdexp
numeric, the standard deviation of the ET.
varexp
numeric, the variance of the ET.
cvcont
numeric, the coefficient of variation for the CT as sdcont/yieldcont
.
acvcont
numeric, the adjusted coefficient of variation for the CT.
cvexp
numeric, the coefficient of variation for the ET as sdexp/yieldexp
.
acvexp
numeric, the adjusted coefficient of variation for the ET.
yieldratio
numeric, the ratio of ET:CT yields as yieldexp/yieldcont
.
sdratio
numeric, the absolute variance ratio of ET:CT yields as sdexp/sdcont
.
cvratio
numeric, the relative variance ratio of ET:CT yields as cvexp/cvcont
.
acvratio
numeric, the adjusted relative variance ratio of ET:CT yields as acvexp/acvcont
.
Rep
integer, the number of replicates for the temporal sequence.
nryears
integer, the number of yield observations in a temporal sequence.
cluster_cont
integer, within a study (Code
field) temporal sequences that share the same value have the same CT across multiple ETs.
UID.C.Len
integer, the number of temporal sequences that have the same cluster_cont
value within a study.
cluster_exp
integer, within a study (Code
field) temporal sequences that share the same value have the same ET across multiple CTs.
UID.T.Len
integer, the number of temporal sequences that have the same cluster_xp
value within a study.
UID1
integer, a unique identifier for each UID within outcomes (UID is unique across all the data).
N.Obs
integer, the number of temporal sequences for a UID (this should equal one).
N.Obs.Study
integer, number of temporal sequences contribude by a study (a unique Code
field value) for a Practice x Outcome combination.
Weight.Study
numeric, a weighting value calculated as (Rep^2/(2xRep))/N.Obs.Study
.
Weight
numeric, a weighting value calculated as (Rep^2/(2xRep))/N.Obs
.
The data supplied needs to have Practice
and Outcome
fields as generated using the ERAg::StandColNames
function.
The units of measurement (the Unit
field) for the supplied data
should contain values of only "Mg/ha", although there is limited functionality to harmonize other units ("kg/ha", "kg/acre", "Kg/fed", "Mg/fed", and
"g/m2") to "Mg/ha".
The Adjusted Coefficient of Variation (acv) is calculated using the metan::acv function.