-
Notifications
You must be signed in to change notification settings - Fork 2
/
FixedEffectModels.Rmd
44 lines (36 loc) · 1.11 KB
/
FixedEffectModels.Rmd
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
---
title: "Fixed Effect Models using R and Julia's `FixedEffectModels`"
author: "Erik Loualiche"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
#output:
# md_document:
# variant: markdown_github
always_allow_html: yes
vignette: >
%\VignetteIndexEntry{Large scale fixed effect models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```r
library(FixedEffectjlr)
JULIA_HOME <- "/Applications/Julia-1.4.app/Contents/Resources/julia/bin/"
FixedEffect_setup(JULIA_HOME)
```
Run the standard example from `FixedEffectModels.jl`
```r
df <- Ecdat::Cigar
reg_res <- FixedEffect(df,
lhs = "sales", rhs = "ndi",
fe = c("state", "year"),
weights = c("pop"),
vcov = c("state") )
```
Waiting for a full `lm` object, I added a `coeftest` object so that it is possible to look at output with stargazer:
```r
df <- Ecdat::Cigar
reg1 <- FixedEffect(df, "sales", "ndi", c("state", "year"), "pop", "robust")
reg2 <- FixedEffect(df, "sales", "ndi", c("state", "year"), "pop", c("state"))
stargazer::stargazer(reg1$summary$coeftest, reg2$summary$coeftest,
type = "text")
```