Skip to contents

This function outputs the predictions for each factor for a single model. Each factor is put on a separate Excel sheet.

Usage

report_tables(model, classify)

Arguments

model

The model to generate predictions for.

The value may be:

  • asreml

  • glmmTBM (not yet implemented)

classify

character A string specifying the factors in the model to predict on. If multiple are specified separate with either * or :. For example Nitrogen:Variety or Nitrogen*Variety.

Value

list of data.frame A list of data frames. The first data frame is the ANOVA for the model. The remaining data frames are the prediction tables from the classify object.

Examples

library(asreml)
model <- asreml(
    fixed = yield ~ Variety + Nitrogen + Variety:Nitrogen,
    random = ~idv(Blocks) + idv(Blocks):idv(Wplots),
    residual = ~idv(units),
    data = oats
)

report_tables(
    model,
    classify = "Variety:Nitrogen"
)
#> $Anova
#>             Effect yield
#> 1          Variety 0.226
#> 2         Nitrogen 0.000
#> 3 Variety:Nitrogen 0.936
#> 
#> $Variety
#>     treatment group      lsd    means
#> 1  Marvellous     a 15.77278 109.7917
#> 2 Golden_rain     a 15.77278 104.5000
#> 3     Victory     a 15.77278  97.6250
#> 
#> $Nitrogen
#>   treatment group     lsd     means
#> 1   0.6_cwt     a 8.93407 123.38889
#> 2   0.4_cwt     b 8.93407 114.22222
#> 3   0.2_cwt     c 8.93407  98.88889
#> 4     0_cwt     d 8.93407  79.38889
#> 
#> $`Variety:Nitrogen`
#>              treatment group      lsd     means
#> 1   Marvellous,0.6_cwt     a 18.54066 126.83333
#> 2  Golden_rain,0.6_cwt    ab 18.54066 124.83333
#> 3      Victory,0.6_cwt    ab 18.54066 118.50000
#> 4   Marvellous,0.4_cwt   abc 18.54066 117.16667
#> 5  Golden_rain,0.4_cwt   abc 18.54066 114.66667
#> 6      Victory,0.4_cwt   abc 18.54066 110.83333
#> 7   Marvellous,0.2_cwt   bcd 18.54066 108.50000
#> 8  Golden_rain,0.2_cwt   cde 18.54066  98.50000
#> 9      Victory,0.2_cwt   def 18.54066  89.66667
#> 10    Marvellous,0_cwt   efg 18.54066  86.66667
#> 11   Golden_rain,0_cwt    fg 18.54066  80.00000
#> 12       Victory,0_cwt     g 18.54066  71.50000
#> 

if (FALSE) { # \dontrun{
# Using it to write with writexl
tables <- excel_prediction_file(
    model,
    classify = "Variety:Nitrogen",
)

writexl::write_xlsx(x = tables, path = "Prediction_Tables.xlsx")
} # }