No bugs while compiling, but the issue is while trying to create a word document via Rmarkdown. Would be really grateful for any kind of advice. Do i need to install any additional packages?
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
##Question 1
install.packages("rmarkdown")
library(rmarkdown)
library(tidyverse)
library (readr)
Journals <- read_csv("Journals.csv")
model_lm1=lm(pages~society+field, data=Journals)
summary(model_lm1)
library(texreg)
texreg(model_lm1)
texreg::texreg(model_lm1)
htmlreg(model_lm1)
##Question 2
model_lm2=lm(pages~society*field, data=Journals)
summary(model_lm2)
BIC(model_lm1, model_lm2)
AIC(model_lm1, model_lm2)
summary(model_lm1)
summary(model_lm2)
##BIC shows that model 2 is better
##AIC shows that model 2 is also better
##Question 3
library(car)
vif(model_lm1)
model_lm1=lm(pages~society+field, data=Journals)
vif(model_lm1)
##value < 5
sum(hatvalues(model_lm1)>2*mean(hatvalues(model_lm1)))
sum(abs(rstudent(model_lm1))>3)
sum(abs(rstudent(model_lm1))>3 & hatvalues(model_lm1) > 2*mean(hatvalues(model_lm1)))
qqPlot(model_lm1)
library(lmtest)
bptest(model_lm1)
library(texreg)
library(sandwich)
vcov=vcovHC(model_lm1)
sd=sqrt(diag(vcov))
t=coef(model_lm1)/sd
t
```