Skip to content

Commit

Permalink
Included test for the semiparametric estimation process.
Browse files Browse the repository at this point in the history
  • Loading branch information
segsell committed Jan 29, 2020
1 parent c3b4569 commit 1f40a9b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Binary file not shown.
31 changes: 31 additions & 0 deletions grmpy/test/test_semipar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
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("promotion/grmpy_tutorial_notebook/files/tutorial_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 1f40a9b

Please sign in to comment.