-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Included test for the semiparametric estimation process.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |