Skip to content

Commit

Permalink
Updated resource paths for semipar test.
Browse files Browse the repository at this point in the history
  • Loading branch information
segsell committed Jan 30, 2020
1 parent e5c9ffc commit 416ed81
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 0 deletions.
112 changes: 112 additions & 0 deletions grmpy/test/resources/replication_semipar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
ESTIMATION:
file: promotion/grmpy_tutorial_notebook/data/aer-replication-mock.pkl
dependent: wage
indicator: state
semipar: True
show_output: True
logit: True
nbins: 30
bandwidth: 0.322
gridsize: 500
trim_support: True
reestimate_p: False
rbandwidth: 0.05
derivative: 1
degree: 2
ps_range: [0.005, 0.995]
TREATED:
order:
- exp
- expsq
- lwage5
- lurate
- cafqt
- cafqtsq
- mhgc
- mhgcsq
- numsibs
- numsibssq
- urban14
- lavlocwage17
- lavlocwage17sq
- avurate
- avuratesq
- d57
- d58
- d59
- d60
- d61
- d62
- d63
UNTREATED:
order:
- exp
- expsq
- lwage5
- lurate
- cafqt
- cafqtsq
- mhgc
- mhgcsq
- numsibs
- numsibssq
- urban14
- lavlocwage17
- lavlocwage17sq
- avurate
- avuratesq
- d57
- d58
- d59
- d60
- d61
- d62
- d63
CHOICE:
params:
- 1.0
order:
- const
- cafqt
- cafqtsq
- mhgc
- mhgcsq
- numsibs
- numsibssq
- urban14
- lavlocwage17
- lavlocwage17sq
- avurate
- avuratesq
- d57
- d58
- d59
- d60
- d61
- d62
- d63
- lwage5_17numsibs
- lwage5_17mhgc
- lwage5_17cafqt
- lwage5_17
- lurate_17
- lurate_17numsibs
- lurate_17mhgc
- lurate_17cafqt
- tuit4c
- tuit4cnumsibs
- tuit4cmhgc
- tuit4ccafqt
- pub4
- pub4numsibs
- pub4mhgc
- pub4cafqt
DIST:
params:
- 0.1
- 0.0
- 0.0
- 0.1
- 0.0
- 1.0
33 changes: 33 additions & 0 deletions grmpy/test/test_semipar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
This module contains a simple test for the equality of the results of
R's locpoly function and grmpy's locpoly function. Therefore,
the mock data set from Carneiro et al (2011) is used.
"""
import pandas as pd
import numpy as np

from numpy.testing import assert_equal
from grmpy.estimate.estimate import fit

import sys

sys.path.append("..")


def test_semipar_replication():
"""
This function asserts equality between the test mte_u and the replicated
mte_u
"""
test_rslt = fit(
"resources/replication_semipar.yml", semipar=True
)

expected_mte_u = pd.read_pickle("resources/replication-results-mte_u.pkl")

assert_equal(np.round(test_rslt["mte_u"], 6), np.round(expected_mte_u, 6))


if __name__ == "__main__":
test_semipar_replication()
print("Everything passed")

0 comments on commit 416ed81

Please sign in to comment.