-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresults.Rmd
More file actions
60 lines (46 loc) · 1.68 KB
/
results.Rmd
File metadata and controls
60 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "Result Presentation"
lang: en-EN
output:
word_document: default
pdf_document:
keep_tex: yes
editor_options:
chunk_output_type: console
---
```{r, include=FALSE}
library(dplyr)
library(memisc)
library(haven)
library(lmtest)
library(ggplot2)
library(ggfortify)
library(pander)
library(lme4)
library(ggpubr)
library(car)
library(sandwich)
library(ggthemes)
library(Hmisc)
library(huxtable)
df = as.data.frame(read_spss("BD final - estudantes.sav"))
dataF = transmute(df, oportunidade = as.numeric(df$tri_oportunidade),
pressao = as.numeric(df$losango_motivacao),
racionalizacao = as.numeric(df$tri_dist_moral),
fraudenavg = rowMeans(df[68:71], na.rm = TRUE),
kgavg = as.factor(as.integer(rowMeans(df[51:67], na.rm = TRUE))),
kfavg = rowMeans(df[34:50], na.rm = TRUE))
ModelN = lm(data = dataF, fraudenavg ~ oportunidade + pressao + racionalizacao)
ModelC = lm(data = dataF, kfavg ~ oportunidade + pressao + racionalizacao + kgavg)
```
```{r, results='asis', warning=FALSE}
#1st Graph
ggplot(ModelC) + stat_qq(aes(sample = ModelC$residuals), color = "black", alpha = 0.2) + geom_abline(intercept = mean(ModelC$residuals), slope = sd(ModelC$residuals), color = "red") + theme_calc()
#2nd Graph
ggplot(ModelC, aes(x = .resid, y = ..density..)) + geom_histogram(bins = 15, color = "white", fill = "black") + theme_calc()
#3rd Graph
ggplot(ModelN, aes(x = .fitted, y = .resid)) + geom_point(color = "black", alpha = 0.3) + stat_smooth(color = "red") + theme_calc()
reg_table <- huxreg(ModelN, ModelC, statistics = c(N = "nobs", R2 = "r.squared", R2Adj = "adj.r.squared",
"AIC"))
print_md(reg_table)
```