Repository: econ-ark/HARK

Issue:
DiscreteDistribution.drawDiscrete() -> DiscreteDistribution.draw()
Rename this method.

Discussion:

Patch:
diff --git a/Documentation/CHANGELOG.md b/Documentation/CHANGELOG.md
index fac4d72a..acef26bb 100644
--- a/Documentation/CHANGELOG.md
+++ b/Documentation/CHANGELOG.md
@@ -28,6 +28,7 @@ interpolation for problems with CRRA utility. See [#888](https://github.com/econ
 
 * Move AgentType constructor parameters docs to class docstring so it is rendered by Sphinx.
 * Remove uses of deprecated time.clock [#887](https://github.com/econ-ark/HARK/pull/887)
+* Rename DiscreteDistribution.drawDiscrete() to draw()
 
 ### 0.10.8
 
diff --git a/HARK/ConsumptionSaving/ConsAggShockModel.py b/HARK/ConsumptionSaving/ConsAggShockModel.py
index b483ad8d..db7a71df 100644
--- a/HARK/ConsumptionSaving/ConsAggShockModel.py
+++ b/HARK/ConsumptionSaving/ConsAggShockModel.py
@@ -530,7 +530,7 @@ class AggShockMarkovConsumerType(AggShockConsumerType):
                 PermGroFacNow = self.PermGroFac[t - 1]  # and permanent growth factor
 
                 # Get random draws of income shocks from the discrete distribution
-                ShockDraws = IncomeDstnNow.drawDiscrete(N, exact_match=True)
+                ShockDraws = IncomeDstnNow.draw(N, exact_match=True)
                 # Permanent "shock" includes expected growth
                 PermShkNow[these] = ShockDraws[0] * PermGroFacNow
                 TranShkNow[these] = ShockDraws[1]
@@ -546,7 +546,7 @@ class AggShockMarkovConsumerType(AggShockConsumerType):
             PermGroFacNow = self.PermGroFac[0]  # and permanent growth factor
 
             # Get random draws of income shocks from the discrete distribution
-            ShockDraws = IncomeDstnNow.drawDiscrete(N, exact_match=True)
+            ShockDraws = IncomeDstnNow.draw(N, exact_match=True)
             # Permanent "shock" includes expected growth
             PermShkNow[these] = ShockDraws[0] * PermGroFacNow
             TranShkNow[these] = ShockDraws[1]
@@ -1975,7 +1975,7 @@ class CobbDouglasEconomy(Market):
         """
         sim_periods = self.act_T
         Events = np.arange(self.AggShkDstn.pmf.size)  # just a list of integers
-        EventDraws = self.AggShkDstn.drawDiscrete(N=sim_periods, X=Events)
+        EventDraws = self.AggShkDstn.draw(N=sim_periods, X=Events)
         PermShkAggHist = self.AggShkDstn.X[0][EventDraws]
         TranShkAggHist = self.AggShkDstn.X[1][EventDraws]
 
@@ -2246,7 +2246,7 @@ class SmallOpenEconomy(Market):
         """
         sim_periods = self.act_T
         Events = np.arange(self.AggShkDstn.pmf.size)  # just a list of integers
-        EventDraws = self.AggShkDstn.drawDiscrete(N=sim_periods, X=Events)
+        EventDraws = self.AggShkDstn.draw(N=sim_periods, X=Events)
         PermShkAggHist = self.AggShkDstn.X[0][EventDraws]
         TranShkAggHist = self.AggShkDstn.X[1][EventDraws]
 
@@ -2480,7 +2480,7 @@ class CobbDouglasMarkovEconomy(CobbDouglasEconomy):
         PermShkAggHistAll = np.zeros((StateCount, sim_periods))
         TranShkAggHistAll = np.zeros((StateCount, sim_periods))
         for i in range(StateCount):
-            AggShockDraws = self.AggShkDstn[i].drawDiscrete(N=sim_periods)
+            AggShockDraws = self.AggShkDstn[i].draw(N=sim_periods)
             PermShkAggHistAll[i, :] = AggShockDraws[0, :]
             TranShkAggHistAll[i, :] = AggShockDraws[1, :]
 
diff --git a/HARK/ConsumptionSaving/ConsGenIncProcessModel.py b/HARK/ConsumptionSaving/ConsGenIncProcessModel.py
index 03c9c208..e10f49ad 100644
--- a/HARK/ConsumptionSaving/ConsGenIncProcessModel.py
+++ b/HARK/ConsumptionSaving/ConsGenIncProcessModel.py
@@ -1031,7 +1031,7 @@ class GenIncProcessConsumerType(IndShockConsumerType):
             # Calculate distribution of persistent income in each period of lifecycle
             for t in range(len(self.PermShkStd)):
                 if t > 0:
-                    PermShkNow = self.PermShkDstn[t - 1].drawDiscrete(N=self.AgentCount)
+                    PermShkNow = self.PermShkDstn[t - 1].draw(N=self.AgentCount)
                     pLvlNow = self.pLvlNextFunc[t - 1](pLvlNow) * PermShkNow
                 pLvlGrid.append(getPercentiles(pLvlNow, percentiles=self.pLvlPctiles))
 
@@ -1055,7 +1055,7 @@ class GenIncProcessConsumerType(IndShockConsumerType):
 
                 for j in range(self.T_cycle):  # Update persistent income
                     these = t_cycle == j
-                    PermShkTemp = self.PermShkDstn[j].drawDiscrete(N=np.sum(these))
+                    PermShkTemp = self.PermShkDstn[j].draw(N=np.sum(these))
                     pLvlNow[these] = self.pLvlNextFunc[j](pLvlNow[these]) * PermShkTemp
                 t_cycle = t_cycle + 1
                 t_cycle[t_cycle == self.T_cycle] = 0
diff --git a/HARK/ConsumptionSaving/ConsIndShockModel.py b/HARK/ConsumptionSaving/ConsIndShockModel.py
index a4e7e181..730cf60e 100644
--- a/HARK/ConsumptionSaving/ConsIndShockModel.py
+++ b/HARK/ConsumptionSaving/ConsIndShockModel.py
@@ -1992,7 +1992,7 @@ class IndShockConsumerType(PerfForesightConsumerType):
                 ]  # set current income distribution
                 PermGroFacNow = self.PermGroFac[t - 1]  # and permanent growth factor
                 # Get random draws of income shocks from the discrete distribution
-                IncShks = IncomeDstnNow.drawDiscrete(N)
+                IncShks = IncomeDstnNow.draw(N)
                 PermShkNow[these] = (
                     IncShks[0, :] * PermGroFacNow
                 )  # permanent "shock" includes expected growth
diff --git a/HARK/ConsumptionSaving/ConsMedModel.py b/HARK/ConsumptionSaving/ConsMedModel.py
index bd4c2c64..d77f8152 100644
--- a/HARK/ConsumptionSaving/ConsMedModel.py
+++ b/HARK/ConsumptionSaving/ConsMedModel.py
@@ -821,7 +821,7 @@ class MedShockConsumerType(PersistentShockConsumerType):
             these = t == self.t_cycle
             N = np.sum(these)
             if N > 0:
-                MedShkNow[these] = self.MedShkDstn[t].drawDiscrete(N)
+                MedShkNow[these] = self.MedShkDstn[t].draw(N)
                 MedPriceNow[these] = self.MedPrice[t]
         self.shocks["MedShkNow"] = MedShkNow
         self.shocks["MedPriceNow"] = MedPriceNow
diff --git a/HARK/ConsumptionSaving/ConsPrefShockModel.py b/HARK/ConsumptionSaving/ConsPrefShockModel.py
index 8fdf6f8d..9fdb51ce 100644
--- a/HARK/ConsumptionSaving/ConsPrefShockModel.py
+++ b/HARK/ConsumptionSaving/ConsPrefShockModel.py
@@ -179,7 +179,7 @@ class PrefShockConsumerType(IndShockConsumerType):
             these = t == self.t_cycle
             N = np.sum(these)
             if N > 0:
-                PrefShkNow[these] = self.PrefShkDstn[t].drawDiscrete(N)
+                PrefShkNow[these] = self.PrefShkDstn[t].draw(N)
         self.shocks["PrefShkNow"] = PrefShkNow
 
     def getControls(self):
diff --git a/HARK/distribution.py b/HARK/distribution.py
index 42c1b3f0..c635f22c 100644
--- a/HARK/distribution.py
+++ b/HARK/distribution.py
@@ -557,7 +557,7 @@ class DiscreteDistribution(Distribution):
 
         return indices
 
-    def drawDiscrete(self, N, X=None, exact_match=False):
+    def draw(self, N, X=None, exact_match=False):
         """
         Simulates N draws from a discrete distribution with probabilities P and outcomes X.
 


Test patch:
diff --git a/HARK/tests/test_distribution.py b/HARK/tests/test_distribution.py
index 3c32de9d..05ec6bfe 100644
--- a/HARK/tests/test_distribution.py
+++ b/HARK/tests/test_distribution.py
@@ -22,11 +22,11 @@ class DiscreteDistributionTests(unittest.TestCase):
     with default seed.
     """
 
-    def test_drawDiscrete(self):
+    def test_draw(self):
         self.assertEqual(
             DiscreteDistribution(
                 np.ones(1),
-                np.zeros(1)).drawDiscrete(1)[
+                np.zeros(1)).draw(1)[
                 0
             ],
             0,