ANOVA

knitr::opts_chunk$set(echo = F, results = T, message = F, warning = F, comment = "")
source(here::here("R", "function.R"))
library(plyr)
library(broom)
library(dplyr)
library(pander)
library(afex)
library(ggpubr)
library(car)
library(MESS)
# data("Ericksen")
# d<-Ericksen
# d$id<-seq(1:nrow(d))
# model<-lm(highschool ~ city + language,d)
d<-data
x<- model # the second unknown parameter
# show_text <- grepl("Two",x$method, fixed =F)

R output

pander::pander(x)
# dv<-strsplit(x$data.name, split = " by ")[[1]][1] # dependent variable
# iv<-strsplit(x$data.name, split = " by ")[[1]][2] # independent variable

Text

y<-lm_txt(x)
for (v in row.names(y)){
  # Add some text
  cat(v, ": **", y[v,]$full, "**",  sep="")  
  cat("  \n")  

  # Create plots.....

  # insert page break
  cat("\n")
  cat("#####\n")
  cat("\n")

}

Assumptions

# https://stats.stackexchange.com/questions/19227/possible-extensions-to-the-default-diagnostic-plots-for-lm-in-r-and-in-general
residualPlots(model)
qqPlot(model)
spreadLevelPlot(model)
influenceIndexPlot(model)
influencePlot(model)

# avPlots(model$lm)

Wally plots

# wallyplot(model$lm)
qqnorm.wally <- function(x, y, ...) { qqnorm(y, ...) ; abline(a=0, b=1) }

wallyplot(model, FUN=qqnorm.wally, hide=FALSE)
wallyplot(model, FUN = residualplot, hide = FALSE)


remi-lafitte/inline documentation built on March 6, 2021, 1:38 a.m.