mercredi 14 juin 2017

Apply a function on several outputs at the same time

I was wondering how I can modify this code to apply durbin-watson test for each model separately. fit includes different regression models for different dependent variables and I want to run dwtest on each model separately.

    formula<-as.formula(paste0("cbind(", paste(names(mtcars)[-c(4,8,9)], collapse = ","), ") ~ hp*vs*am"))
    fit<-aov(formula, data=mtcars)
library(lmtest)

I want to run dwtest(fit) but I don't know how?

Aucun commentaire:

Enregistrer un commentaire