predict.afex_aov {afex}R Documentation

Predict method for afex_aov objects

Description

Predicted values based on afex_aov objects.

Usage

## S3 method for class 'afex_aov'
predict(object, newdata, append = FALSE, colname_predict = ".predict", ...)

Arguments

object

afex_aov object.

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

append

If set to TRUE returns the residuals/fitted values appended as an additional column to the long data. Recommended when data was aggregated across within conditions.

colname_predict

Name of the appended column when append = TRUE.

...

Not used.

Value

A vector of predicted values corresponding to the data in object$data$long or to newdata, or if append = TRUE a data frame with an additional column of predicted values.

Author(s)

Mattan S. Ben-Shachar

Examples


data(obk.long, package = "afex")

# estimate mixed ANOVA on the full design:
fit <- aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
              within = c("phase", "hour"), observed = "gender")

new_data <- expand.grid(
  treatment = "A",
  gender = "F",
  phase = c("pre", "post"),
  hour = c(1, 5)
)

predict(fit, newdata = new_data)
predict(fit, newdata = new_data, append = TRUE)

[Package afex version 1.3-1 Index]