| addBacktransforms.alldiffs {asremlPlus} | R Documentation | 
Adds or recalculates the backtransforms component of an alldiffs.object.
Description
Given an alldiffs.object, adds or recalculate its backtransforms component. 
The values of transform.power, offset, scale and transform.function 
from the backtransforms component will be used, unless this component is NULL 
when the values supplied in the call will be used.
Usage
## S3 method for class 'alldiffs'
addBacktransforms(alldiffs.obj, 
                  transform.power = 1, offset = 0, scale = 1, 
                  transform.function =  "identity", ...)Arguments
| alldiffs.obj | An  | 
| transform.power | A  | 
| offset | A  | 
| scale | A  | 
| transform.function | A  | 
| ... | Provision for passing arguments to functions called internally - not used at present. | 
Value
An alldiffs.object with components 
predictions, vcov, differences, p.differences, 
sed, LSD and backtransforms.
The backtransforms component will have the attributes (i) LSDtype, 
LSDby and LSDstatistic added from the predictions component and 
(ii) transform.power, offset, scale, and link.
Author(s)
Chris Brien
See Also
asremlPlus-package, as.alldiffs, sort.alldiffs, 
subset.alldiffs, print.alldiffs,  
 
renewClassify.alldiffs, redoErrorIntervals.alldiffs,  
plotPredictions.data.frame, 
 
predictPlus.asreml, predictPresent.asreml
Examples
##Subset WaterRunoff data to reduce time to execute
data(WaterRunoff.dat)
tmp <- subset(WaterRunoff.dat, Date == "05-18" & Benches != "3")
##Use asreml to get predictions and associated statistics
## Not run: 
asreml.options(keep.order = TRUE) #required for asreml-R4 only
current.asr <- asreml(fixed = log.Turbidity ~ Benches + (Sources * (Type + Species)), 
                      random = ~ Benches:MainPlots,
                      keep.order=TRUE, data= tmp)
current.asrt <- as.asrtests(current.asr, NULL, NULL)
TS.diffs <- predictPlus(classify = "Sources:Type", 
                        asreml.obj = current.asr, 
                        wald.tab = current.asrt$wald.tab, 
                        present = c("Sources", "Type", "Species"))
## End(Not run)
##Use lmeTest and emmmeans to get predictions and associated statistics
if (requireNamespace("lmerTest", quietly = TRUE) && 
    requireNamespace("emmeans", quietly = TRUE))
{
  m1.lmer <- lmerTest::lmer(log.Turbidity ~ Benches + (Sources * (Type + Species)) + 
                              (1|Benches:MainPlots),
                            data=tmp)
  TS.emm <- emmeans::emmeans(m1.lmer, specs = ~ Sources:Species)
  TS.preds <- summary(TS.emm)
  den.df <- min(TS.preds$df, na.rm = TRUE)
  ## Modify TS.preds to be compatible with a predictions.frame
  TS.preds <- as.predictions.frame(TS.preds, predictions = "emmean", 
                                   se = "SE", interval.type = "CI", 
                                   interval.names = c("lower.CL", "upper.CL"))
  
  ## Form an all.diffs object and check its validity
  TS.vcov <- vcov(TS.emm)
  TS.diffs <- allDifferences(predictions = TS.preds, classify = "Sources:Species", 
                             vcov = TS.vcov, tdf = den.df)
  validAlldiffs(TS.diffs)
}  
## Recalculate the back-transforms of the predictions obtained using asreml or lmerTest
if (exists("TS.diffs"))
{
  TS.diffs <- addBacktransforms.alldiffs(TS.diffs, transform.power = 0)
}