knitr::opts_chunk$set(echo = F, results = T, message = F, warning = F, comment = "") source(here::here("R", "function.R")) library(plyr) library(dplyr) library(afex) library(ggpubr) library(car) library(MESS) d<-data # data("Ericksen") # d<-Ericksen # d$id<-seq(1:nrow(d)) # d$language<-as.numeric(d$language) # model<-afex::aov_4(highschool ~ city + language+ (1|id),d, factorize = F) # model<-afex::aov_ez(id = "id", dv = "highschool", # data = d, covariate = "language", between = "city", factorize = F)
x<- model # the second unknown parameter
x$anova_table # dv<-strsplit(x$data.name, split = " by ")[[1]][1] # dependent variable # iv<-strsplit(x$data.name, split = " by ")[[1]][2] # independent variable summary(x)
y<-aov4_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") }
col<-colnames(x$data$long[,-1]) n<-length(col) dv<-col[n] iv<-gsub(":", "+", row.names(y)) # interaction(f1, f2) for(v in iv){ # attach(d) # w<-eval(parse(text = v)) # z<-eval(parse(text = dv)) formu<-as.formula(paste0(dv, "~", v)) moy<-aggregate(formu, data = d, FUN = function (x) (round(mean(x),2))) vari<-aggregate(formu, data = d, FUN = function (x) (round(var(x),2))) # means<-tapply(d[,dv], d[,v], mean) # variance<-tapply(d[,dv], d[,v], var) cat(paste(v, "Means", sep = "-"), sep = "\n") print(moy) cat(paste(v, "Variances", sep = "-"),sep = "\n") print(vari) }
# https://stats.stackexchange.com/questions/19227/possible-extensions-to-the-default-diagnostic-plots-for-lm-in-r-and-in-general residualPlots(model$lm) qqPlot(model$lm) spreadLevelPlot(model$lm) influenceIndexPlot(model$lm) influencePlot(model$lm) # avPlots(model$lm)
# wallyplot(model$lm) qqnorm.wally <- function(x, y, ...) { qqnorm(y, ...) ; abline(a=0, b=1) } wallyplot(model$lm, FUN=qqnorm.wally, hide = F) wallyplot(model$lm, FUN = residualplot, hide=F)
for (var in LETTERS[1:6]){ # Add some text cat("Variable: **", paste(var), "**", sep="") cat(" \n") cat("More Text") cat(" \n") cat("Even more text") cat(" \n") # Create plots..... # insert page break cat("\n") cat("#####\n") cat("\n") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.