Skip to content

Commit

Permalink
test2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Loualiche committed Mar 30, 2018
1 parent 74a433b commit f756543
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Imports:
Suggests:
magrittr,
lmtest,
stargazer,
knitr,
testthat,
rmarkdown
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# R interface for Fixed Effect Models

[![Build Status](https://travis-ci.org/eloualiche/FixedEffectjlr.svg?branch=master)](https://travis-ci.org/eloualiche/FixedEffectjlr)
[![codecov](https://codecov.io/gh/eloualiche/FixedEffectjlr/branch/master/graph/badge.svg)](https://codecov.io/gh/eloualiche/FixedEffectjlr)



Expand Down
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_tmp.R
3 changes: 2 additions & 1 deletion tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ Sys.setenv("R_TESTS" = "")

library(testthat)
library(FixedEffectjlr)

library(data.table)
library(stargazer)

df = fread("./Cigar.csv")

test_check("FixedEffectjlr")
17 changes: 16 additions & 1 deletion tests/testthat/test-StandardLM.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,30 @@ context("Standard Linear Model")
test_that("run the Linear Model example", {
skip_on_cran()

#JULIA_HOME = "/Applications/Julia-0.6.app/Contents/Resources/julia/bin"
# JULIA_HOME = "/Applications/Julia-0.6.app/Contents/Resources/julia/bin"
# FixedEffect_setup(JULIA_HOME) # my computer cannot find julia
FixedEffect_setup()

r <- FixedEffect_nse(df, sales~ndi, state+year, pop, cluster(state))

# Test of structure of result stuff
expect_equal(names(r),
c("results", "summary"))

# Test of summary output
expect_equal(as.vector(r$summary$mat),
c(-0.005262641, 0.001440434, -3.653511, 0.0002685935, -0.008088374, -0.002436907),
tolerance = 0.001)
# Test of coefficient output
expect_is(r$summary$coeftest, "coeftest")
tbl <- stargazer(r$summary$coeftest, type="text")
expect_output(str(tbl), "chr [1:12]", fixed = TRUE)

r <- FixedEffect(df, lhs = "sales", rhs = "ndi", fe = "state + year",
weights = "pop", vcov = "cluster(state)")
expect_equal(as.vector(r$summary$mat),
c(-0.005262641, 0.001440434, -3.653511, 0.0002685935, -0.008088374, -0.002436907),
tolerance = 0.001)


})

0 comments on commit f756543

Please sign in to comment.