Expected `abs(Trt.pred$predicted.value[3] - 109.07892) < 1e-04` to be TRUE.
Differences:
`actual`:   [32mFALSE[39m
`expected`: [32mTRUE[39m

cat("#### Test for Intercept prediction on Oats with asreml42\n")
m1.asr <- asreml(Yield ~ Nitrogen*Variety,
testthat::expect_true(abs( Int.pred$predicted.value - 103.9722) < 1e-04)
testthat::expect_true(abs( Int.diffs$predictions$predicted.value - 103.9722) < 1e-04)
cat("#### Test for NA on Oats with asreml42\n")
#Test for NA in classify with predictPlus (no NA level)
Trt.pred <- predictPlus(m1.asr, classify="(Variety:Nitrogen)", tables = "none")$predictions
testthat::expect_true(abs( Trt.pred$predicted.value[3] - 109.07892) < 1e-04)
testthat::expect_true(abs( Trt.pred$standard.error[3] - 9.414492) < 1e-04)
#Test for NA in classify with predictPlus (after omit NA)
m1.asr <- asreml(Yield ~ xNitrogen*Variety,
#Test for NA in numeric classify with predictPlus (no NA level)
levels = list(xNitrogen =  c(0, 0.2, 0.4, 0.6)),
testthat::expect_true(abs( Trt.pred$predicted.value[3] - 105.99910) < 1e-04)
testthat::expect_true(abs( Trt.pred$standard.error[3] - 8.403037) < 1e-04)
#Check if NA level included as a level in Nitrogen
Oats.dat$Nitrogen <- factor(Oats.dat$Nitrogen, exclude = NULL)
#Test for NA in classify with predictPlus (with NA level)
#Test with NA for all values of a level equal to NA
Oats.dat$Nitrogen[Oats.dat$Nitrogen == 0.4] <- NA
#Test for NA of all values of one level of a factor in classify with predictPlus (no NA level)
testthat::expect_true(abs( Trt.pred$predicted.value[3] - 118.50000) < 1e-04)
testthat::expect_true(all(abs( Trt.pred$standard.error - 9.106977) < 1e-04))
#Test with NA for all values of a level equal to NA (na.method set to omit)
testthat::expect_true(all(abs( Trt.pred$standard.error - 8.926103) < 1e-04))
#Test with NA for all values of a level equal to NA (na.method set to default)
testthat::expect_error( #from asreml because there are missing x values
regexp = "missing values among Nitrogen,Variety,Blocks,Wplots,units.")
asreml.options(keep.order = TRUE) #required for asreml4 only
current.asr <- asreml(fixed = pH ~ Benches + (Sources * (Type + Species)),
current.asrt <- as.asrtests(current.asr, NULL, NULL)
diffs <- predictPlus(classify = "Sources:Type",
asreml.obj = current.asr, tables = "none",
#### Get the observed combinations of the factors and variables in classify
levs <- as.list(levs[levs$Freq != 0, class.facs])
current.asr <- asreml(fixed = log.Turbidity ~ Benches + Sources + Type + Species +
Sources:xDay + Species:xDay + Species:Date,
diffs.p <- predictPlus(asreml.obj = current.asr,
predictions <- predictions[predictions$status == "Estimable",]
x.title <- "Days since first observation"
#Get predictions without specifying levels
data = predictions, wald.tab = current.asrt$wald.tab,
ggplotFuncs = list(ggtitle("Transformed turbidity over time")))
diffs <- predictPlus(asreml.obj = current.asr,
data = diffs$predictions, wald.tab = current.asrt$wald.tab,
titles <- list("Days since first observation", "Days since first observation", "pH", "Turbidity (NTU)")
Sources:Type + Sources:Species + Sources:Species:xDay +
#Example that fails because Date has levels that are not numeric in nature
testthat::expect_error(diff.list <- predictPresent(terms = "Date:Sources:Species",
regexp = "predict.asreml has not returned the sed component for the predictions as requested")
#Example that does not produce predictions because has Date but not xDay
# parallel and levels are arguments from predict.asreml - plotted against xDay because Date is nonnumeric in nature
diff.list <- predictPresent.asreml(asreml.obj = current.asrt$asreml.obj,
# test that backtransforms have halfLSD intervals
#### This test is not relevant to asreml3 because its saving of sed and vcov are different
cat("#### Test for error when no predictions.asreml42\n")
args=list(fixed = y ~ Species*Substrate*Irrigation,
maxit=50, workspace = 1e08, stepsize = 0.0001))
regexp = "predict.asreml has not returned the sed component for the predictions as requested",
regexp = "predict.asreml has not returned the variance matrix of the predictions as requested",
diffs <- predictPlus.asreml(classify = "Sources:Type",
testthat::expect_silent(plotPvalues(p, x = "Rows", y = "Columns",
show.sig = TRUE, sig.size = 5, sig.colour = "blue"))
show.sig = TRUE, sig.size = 5, sig.face = "bold",
pdata <- plotPvalues(diffs, sections = "Sources", show.sig = TRUE)
#Plot without sections, but automatic gridspacing
pupdata <- plotPvalues(diffs, show.sig = TRUE, factors.per.grid = 1)
#Plot without sections, but automatic gridspacing and upper triangle
pupdata <- plotPvalues(diffs, show.sig = TRUE, factors.per.grid = 1,
#Plot without sections, but manual gridspacing and upper triangle
pupdata <- plotPvalues(diffs, show.sig = TRUE, gridspacing = rep(c(3,4), c(4,2)),
#Plot without sections, but manual gridspacing and lower triangle
pupdata <- plotPvalues(diffs, sections = "Sources", show.sig = TRUE, triangles = "upper")
pdata <- plotPvalues(LeafSucculence.diff, gridspacing = 3, show.sig = TRUE,
pdata <- plotPvalues(LeafSucculence.diff, factors.per.grid = 2, show.sig = TRUE,
pdata <- plotPvalues(LeafSucculence.diff, sections = c("Depths","Slope"),
cat("#### Test for factor combinations asreml42\n")
LeafSucculence.diff <- recalcLSD(LeafSucculence.diff, LSDtype = "factor.combinations",
diffs <- recalcLSD.alldiffs(diffs, LSDtype = "factor.combinations", LSDby = "Sources")
Fac3Syrup.dat <- fac.gen(generate=list(Nozzle = Nozzle.lev,
Pressure = Pressure.lev, Speed = Speed.lev),
Fac3Syrup.dat <- data.frame(Test = factor(1:54), Fac3Syrup.dat)
Fac3Syrup.dat <- with(Fac3Syrup.dat, Fac3Syrup.dat[order(SpeedPress, WSpeedPress),])
interaction.ABC.plot(Loss, Pressure, Speed, Nozzle, data=Fac3Syrup.dat)
Fac3Syrup.aov <- aov(Loss ~ Nozzle * Pressure * Speed + Error(Test), Fac3Syrup.dat)
args = list(Loss ~ Nozzle * Pressure * Speed,
testthat::expect_true(abs(summary(m1)$varcomp$component[2] - 27.5) < 1e-05)
wald.tab <- wald.asreml(m1, denDF = "numeric")$Wald
diffs <- predictPlus(m1, classify = "Nozzle:Pressure:Speed",
#linear.transformation = ~(Nozzle + Pressure):Speed,
testthat::expect_true(all(c( "LSDtype", "LSDstatistic") %in% names(attributes(diffs))))
testthat::expect_true((attr(diffs, which = "LSDtype") == "overall"))
diffs.LSD <- recalcLSD(diffs, LSDtype = "factor",
testthat::expect_true(all(c( "LSDtype", "LSDby", "LSDstatistic") %in% names(attributes(diffs.LSD))))
testthat::expect_true((attr(diffs.LSD, which = "LSDtype") == "factor.combinations"))
diffs.LSI <- redoErrorIntervals(diffs.LSD, error.intervals = "half")
diffs <- redoErrorIntervals(diffs, error.intervals = "half", LSDtype = "factor",
LSDby = c("Speed","Pressure"), wald.tab = wald.tab,
LSDby = "Pressure", wald.tab = wald.tab,
#With linear transformation and LSDtype = "factor combinations"
diffs.LSD <- predictPlus(m1, classify = "Nozzle:Pressure:Speed",
linear.transformation = ~(Nozzle + Pressure):Speed,
error.intervals = "half", LSDtype = "factor", LSDby = c("Speed", "Pressure"),
testthat::expect_true(all(c( "LSDtype", "LSDby", "LSDstatistic", "LSDvalues") %in%
testthat::expect_true(attr(diffs.LSD$predictions, which = "LSDtype") == "factor.combinations")
testthat::expect_true(attr(diffs.LSD$predictions, which = "LSDstatistic") == "mean")