[ Search |  Up Level |  Project home |  Index |  Class hierarchy ]

 DP.ox

Static and fundamental elements of the DP class.

 Alpha

 CGTask : GroupTask : Task : DP

The task called in CreateSpaces that creates \(\Gamma\).
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 CreateTheta : ThetaTask : Task : DP

Allocate space for each reachable point \(\theta\) in the state space \(\Theta\).

This task is called in CreateSpaces that loops over the state space Θ and calls the virtual Reachable().

Users do not call this function.
Public methods
 CreateTheta Called in CreateSpaces to set up Θ.
 loop

Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 Data : Task : DP

Base class for Outcomes and Predictions.
Public fields
 logf static File for logging data output.
 lognm static timestamped file name.
 Volume static Volume of output
Public methods
 SetLog static Open data log with timestamp.
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, XUT

 DP

Static elements shared by the user model, groups and data.

The base class for the DDP framework.
Public fields
 Blocks static List of StateBlocks added to the model.
 Chi static list of AuxiliaryValues that depend on the current outcome.
 ClockType static category of clock.
 counter static counter variable.
 curREdensity static density of current group.
 delta static The discount factor δ.
 EOoE static task to integrate outcomes over \(\epsilon\).
 EStoS static task to update tomorrow's state distribution.
 ETT static task to compute endogenous transitions
 gdist static distriubution over groups
 IOE static task to integrate V over semi-exogenous states.
 L static Label for the problem.
 logf static file for diagnostic output.
 lognm static dated file name for diagnostic output
 MyVersion static Version of niqlow that code is written for.
 NKptrans static shared space for N-K iteration.
 NKvindex static
 NxtExog static Array of Exogenous next state indices and transitions.
 parents static List of parent classes.
 S static array of Spaces, using SubVectorNames as names for elements.
 SS static array of `SubSpaces .
 States static List of State Variables added to the model.
 SubVectors static List of variables by vector.
 tod static Outcomes sent to StateToStatePrediction
 tom static
 userState static copy of user's Bellman object used for cloning.
 Volume static Output level.
 XUT static task to compute utility over exogenous states.
Public methods
 Actions static Add variables to the action vector \(\alpha\).
 AuxiliaryOutcomes static Add AuxiliaryValues to \(\chi\).
 CreateSpaces static Initialize all spaces.
 DrawFsamp static Draw a population count random sample of N values from the random effects distribution.
 DrawGroup static Draw γ from Γ according to the density.
 DrawOneExogenous static Draw one \(\epsilon\) vector given following \(P(\epsilon)\).
 EndogenousStates static Add StateVariables to the endogenous vector \(\theta\).
 ExogenousStates static Add StateVariables to the exogenous vector \(\epsilon\).
 GetAind static Return index into the feasible A list for a θ.
 GetPinf static Return \(P_\infty(\theta)\).
 GetPstar static Return choice probability for a \(\theta\) and current \(\gamma\).
 GetTrackTrans static Return tracking transition at a given \(\eta,\theta\) combination.
 GetUseEps static
 GroupVariables static Add TimeInvariants to the group vector \(\gamma\).
 Indicators static Create auxiliary values that are indicators for a state or action.
 Initialize static Initialize static members.
 Interactions static Create and return a list of auxiliary values for interactions.
 KLaggedAction static Create a K-array of lagged values of an action variable.
 KLaggedState static Create an K+1-array of a state variable and K lags of its values.
 MakeGroups static
 MultiInteractions static Create and return a list of auxiliary values for interactions.
 onlyDryRun static For debugging: Set a flag so that CreateSpaces does not actually create the space.
 RecomputeTrans static If changing fixed parameters and UpdateTime==WhenFlagIsSet then next Solve() will recompute transitions.
 SemiExogenousStates static Add StateVariables to the semiexogenous vector \(\eta\).
 SetClock static Set the model clock.
 SetDelta static Set the discount factor, \(\delta\).
 Settheta static Sets the current θ.
 SetUpdateTime static Tell DDP when parameters and transitions have to be updated.
 SetVersion static Checks the version number you send with the current version of niqlow.
 StorePalpha static Ask to store overall \(P*()\) choice probability matrix.
 SubSampleStates static Request that the State Space be subsampled for extrapolation methods such as KeaneWolpin.
 SyncAct static Ensure that ActionVariable current values (v) is synched with the choice vector \(\alpha\).
 UpdateDistribution static
 ValuesCounters static Create an array of counters for different values of a state or action variable.

 DPDebug : ThetaTask : Task : DP

Output routines .
Public fields
 div static const
 ndone static
 OutAll static
 prtfmt static
 prtfmt0 static
 rp static
 SimLabels static
 SVlabels static
 Vlabel0 static
Public methods
 DPDebug
 outAllV static Print the table of value functions and choice probabilities for all fixed effect groups.
 outV static For the current fixed-effect group, print the value function \(EV(\theta)\) and choice probability \(P^\star(\alpha;\epsilon,\eta,\theta)\) or index of max \(P^\star\).
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 DPMixture : RETask : GroupTask : Task : DP

Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from RETask:
fixl, fixr
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 DumpExogTrans : ExTask : Task : DP

. @internal
Public fields
 s
Public methods
 DumpExogTrans Display the exogenous transition as a matrix.
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 EndogTrans : Task : DP

Base Task for constructing the transition for endogenous states.
Public methods
 EndogTrans
 Transitions
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 ExogOutcomes : ExTask : Task : DP

Compute expected outcomes given exogenous vector values.
See also:
EOoE
Public fields
 auxlist static
 chq static
 tmp static
Public methods
 ExpectedOutcomes Compute the expected values of tracked auxiliary variables over the exogenous vector ε
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 ExogUtil : ExTask : Task : DP

Call Utility().
See also:
XUT
Public fields
 AnyExog const indicate there are exogenous variabes so loop is required.
 U stores Utility matrix for current \(\theta\).
Public methods
 Run
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 ExTask : Task : DP

Base Task for looping over \(\epsilon\) and \(\eta\).
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 FETask : GroupTask : Task : DP

The base task for looping over fixed effects. These tasks typically have a member that is a RETask object to do proces random effects conditional on the current fixed effect group.
Public methods
 ~FETask
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 Flags

 Group : DP

A Group object stores information for a point \(\gamma\) in the Group Space \(\Gamma\).

The group space is created internally when the user runs CreateSpaces. The group objects are located in a static array named Gamma that is only accessible directly inside the file DP.ox.

By default MyModel (the user's DP problem) defines a single decision making process. So \(\Gamma\) would have a single element.
A single solution to the dynamic program is then required to solve the model.
Another way to say this is that there is no heterogeneity in the environment across agents.
If a homogeneous model is applied to data, then different agents would have different outcomes solely because of different realizations along the solution path.
Differences in initial states is included in the homogeneous case as long as each agent has the same probability distribution across initial states.

Most applications of dynamic programming involve more than one problem.
MyModel can include more than one problem to be solved by creating Groups.
DDP tries to smart about storage and computation when accounting for different solutions. It does not simply duplicate everything about a single model for each group.
The group space is kept separate from the state space \(\Theta\) in order to economize on storage.
Only results that need to be held for later used are stored in \(\Gamma\) and the state space is reused for each solution of the problem.

The user creates multiple groups by adding time-invariants to the model.
Time Invariant states are classified as either fixed or random effects, derived respectively from FixedEffect and RandomEffect.
FixedEffectBlocks can be used to represent SubEffects and RandomEffectBlocks can be used to represent CorrelatedEffects.

Time-invariants or group variables are added to the model using GroupVariables().
The call to GroupVariables must occur in the user's code between the call to Initialize() and CreateSpaces.
The time-invariants are separated into the \(\gamma_r\) and \(\gamma_f\) subvectors of \(\gamma\). A distinct point in the group space is created for each unique value of the vector \(\gamma.\)
When processing the model (such as solving the DP, calculating a likelihood, etc.), each fixed vector \(\gamma_f\) is processed by looping over all values of the random vector \(\gamma_r\).

Example
Create different DP programs for men and women, and allow people to differ in ability.
    enum{male,female,Ngender}
    enum{lo,hi,Nability}
    Initialize(…);
    ⋮
    GroupVariables(
       a = new RandomEffect("a",Nability),
       g = new FixedEffect("sex",Ngender),
       );
    ⋮
    CreateSpaces(…);
See also:
SetGroup
Public fields
 find Index into fixed effects
 mobj method specific object.
 Palpha Expand Choice Prob matrix.
 Pinfinity Stationary distribution \(P_\infty\) for ergodic clock models.
 pos Position in \(\Gamma\).
 Ptrans State-to-State transition.
 rind Index into random effects
 state Group's state vector.
Public methods
 Density Compute density of current group \(\gamma\) conditional on fixed effects.
 DrawfromStationary Draw \(\theta\) from \(P_\infty(\theta)\) for current \(\gamma\).
 IncPtrans
 Reset Reset a group.
 StationaryDistribution Compute the stationary distribution over reachable states, \(P_\infty(\theta)\).
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, L, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 GroupTask : Task : DP

The base task for processing \(\gamma\).
Public fields
 qtask sub task.
 span const
Public methods
 ~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 I

Public methods
 SetGroup Set the current group.

 Labels

 N

Public methods
 picked
 SubSample
 SubSampleDone

 OutAuto : DPDebug : ThetaTask : Task : DP

Public methods
 OutAuto
Inherited methods from DPDebug:
DPDebug, outAllV, outV
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from DPDebug:
div, ndone, OutAll, prtfmt, prtfmt0, rp, SimLabels, SVlabels, Vlabel0
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 RandomEffectsIntegration : RETask : GroupTask : Task : DP

Integrate over \(\gamma_r\).
Public fields
 flat
 L cumulative likelihood or other outcome.
 path The path object I am processing.
Public methods
 Integrate Integrate over \(\gamma_r\).
 RandomEffectsIntegration .
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from RETask:
fixl, fixr
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 ReSubSample : CreateTheta : ThetaTask : Task : DP

Called when subsampling Θ for KeaneWolpin approximation.

This task is called if the user is asking for a new subsample of \(\Theta\).

It CreateSpaces that loops over the state space \(\Theta\) and calls the virtual Reachable().

If a subsampled state is now not sampled its stored information is destroyed (using Bellman::Delete).

If a non-sampled state is now sampled its point in \(\theta\) is created.

Users do not call this directly.
Public methods
 ReSubSample

Inherited methods from CreateTheta:
CreateTheta, loop
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 RETask : GroupTask : Task : DP

The base task for looping over random effects \(\gamma_r\).
Public fields
 fixl const
 fixr const
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SaveV : DPDebug : ThetaTask : Task : DP

Public fields
 aM const
 MaxChoiceIndex const
 nottop
 r
 s
 stub
 ToScreen const
 TrimTerminals const
 TrimZeroChoice const
Public methods
 SaveV Save the value function as a matrix and/or print.
Inherited methods from DPDebug:
DPDebug, outAllV, outV
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from DPDebug:
div, ndone, OutAll, prtfmt, prtfmt0, rp, SimLabels, SVlabels, Vlabel0
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SDTask : RETask : GroupTask : Task : DP

. @internal
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from RETask:
fixl, fixr
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SemiEV : SemiExTask : ExTask : Task : DP

Loop over \(\eta\) to compute EV.
See also:
IOE
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from SemiExTask:
AnyEta, CurrExogWidth
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SemiExTask : ExTask : Task : DP

Base Task for looping over \(\eta\).
Public fields
 AnyEta const indicate there are \(\eta\) variables so loop is required.
 CurrExogWidth
Public methods
 Run virtual
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SemiTrans : SemiExTask : ExTask : Task : DP

Loop over \(\eta\) to compute transitions.
See also:
EStoS
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from SemiExTask:
AnyEta, CurrExogWidth
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 Space : DDPauxiliary : Zauxiliary

Stores information on a set of state variables, such as θ
See also:
S
Public fields
 C cumulative product of N.
 D dimension of the space.
 M Min indices of var group in state vector.
 N # of values state variables take on.
 size product of VN over VM[] to VX[].
 X maX indices of var group in state vector.
Public methods
 Append
 Space Tracks information about a subvector of the state vector.

 SubSpace : DDPauxiliary : Zauxiliary

Stores information on a set of spaces, such as reality or treatment
Public fields
 ClockIndex static location of the clock object.
 D # of dimensions
 left leftmost state index.
 O vector of offsets
 right rightmost state index
 S static shared spaces
 size # of elements
Public methods
 SubSpace Tracks information about a set of one or more Spaces.
 ~SubSpace

 SVT : DPDebug : ThetaTask : Task : DP

Public fields
 Slist
Inherited methods from DPDebug:
DPDebug, outAllV, outV
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from DPDebug:
div, ndone, OutAll, prtfmt, prtfmt0, rp, SimLabels, SVlabels, Vlabel0
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 SVTrans : EndogTrans : Task : DP

Public fields
 Slist
Public methods
 SVTrans
Inherited methods from EndogTrans:
EndogTrans, Transitions
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 Task : DP

Process (span) space or subspace.

Tasks do the work of Dynamic Programming

In DDP a Task is an operation to go over the part of the space of all diferent variable combinations.

Each specialied task is a derived class from some more generic task.

A Task object has its own state member which is a vector of values at the current point in the operation.

DDP synchronizes the value of the state vector with the current values of all variables in the model.

The engine of a task is its loop() method.

loop() for a task is equivalent to nested loops over some elements of the state vector in purpose-built code.

loop() iterates over the task's range of state variables, defined by left and right indices into the state vector.

Inside the loop() the Task's Run() method is called.

Run() is a virtual method, so the Task's replacement is called inside the shared loop() method.
The loop assigns every possible value of state variables in its vector(s) and for each unique vector call the virtual Run() routine.

A new job can be created by deriving a new Task and supplying a new Run() method.
The loop() is inherited from the parent class.

Tasks can linked to each other in a recursive chain.
The Run() method can in turn call the loop() of an internally stored itask.
This hierarchy of tasks breaks up the problem of spanning the whole space into separate tasks. Tasks are typically ordered from right to left.

Derived classes of tasks are specialized to process different spaces

Data structures for the empirical side of DP are made up of Tasks

GroupTasks process the group space \(\Gamma\) (fixed and random effects).
In turn, FETasks process the \(\gamma_f\) vector and RETasks process \(\gamma_r\).
A Method to solve the DP problem is a FETasks for which its itask is a RETask if random effects are present or a ThetaTask if not.

ThetaTasks process the endogenous state space, \(\Theta\).
For example, CreateTheta is a task that is called once to create objects for each reachable value of \(\theta.\)
A Method task will eventually call a GSolve task which is a ThetaTask to apply a DP solution method at each point of \(\Theta\).

ExTask processes the exogenous vectors \(\epsilon\) and \(\eta\).
These tasks are the lowest level and do the actual work at \(\theta\).
Public fields
 caller const Task that called me (used by methods).
 d index into state of current spanning dimension.
 done Indicates task is done (may require one more trip).
 inner keep going ...
 itask Inner task for a stack of tasks to perform.
 iter Times Run() called while in progress.
 L Label for debugging purposes.
 left const leftmost variable in state to loop over
 MaxTrips max number of outer trips
 right const rightmost variable in state to loop over
 state N×1 vector, current values of all states.
 subspace subspace to use for indexing during the task
 trace static
 trips Trips through the task's space.
Public methods
 list virtual Process a vector (list) of state indices.
 SyncStates Ensure that all StateVariable objects v are synched with the internally stored state vector.
 ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 ThetaTask : Task : DP

Base Class for tasks that loop over the endogenous state space Θ.

The Traverse() method will either loop or list() depending on whether the user asked for the state space Θ to be processed according to a list of reachable states or looping over all combinations of state variable values. This is done with an arguement to Initialize().

Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 UpdateDensity : RETask : GroupTask : Task : DP

Dynamically reset the density over random effects given the current fixed effect group.
Inherited methods from GroupTask:
~GroupTask
Inherited methods from Task:
list, SyncStates, ~Task
Inherited methods from DP:
Actions, AuxiliaryOutcomes, CreateSpaces, DrawFsamp, DrawGroup, DrawOneExogenous, EndogenousStates, ExogenousStates, GetAind, GetPinf, GetPstar, GetTrackTrans, GetUseEps, GroupVariables, Indicators, Initialize, Interactions, KLaggedAction, KLaggedState, MakeGroups, MultiInteractions, onlyDryRun, RecomputeTrans, SemiExogenousStates, SetClock, SetDelta, Settheta, SetUpdateTime, SetVersion, StorePalpha, SubSampleStates, SyncAct, UpdateDistribution, ValuesCounters
Inherited fields from RETask:
fixl, fixr
Inherited fields from GroupTask:
qtask, span
Inherited fields from Task:
caller, d, done, inner, itask, iter, L, left, MaxTrips, right, state, subspace, trace, trips
Inherited fields from DP:
Blocks, Chi, ClockType, counter, curREdensity, delta, EOoE, EStoS, ETT, gdist, IOE, logf, lognm, MyVersion, NKptrans, NKvindex, NxtExog, parents, S, SS, States, SubVectors, tod, tom, userState, Volume, XUT

 CreateTheta

 CreateTheta

CreateTheta :: CreateTheta ( )
Called in CreateSpaces to set up Θ.

 loop

CreateTheta :: loop ( )

 Data

 logf

static decl logf [public]
File for logging data output.

 lognm

static decl lognm [public]
timestamped file name.

 SetLog

static Data :: SetLog ( )
Open data log with timestamp.

 Volume

static decl Volume [public]
Volume of output
See also:
NoiseLevels

 DP

 Actions

static DP :: Actions ( ... )
Add variables to the action vector \(\alpha\).
Parameters:
... ActionVariables to add to \(\alpha\)

See Action Variables for more explanation.

Example:
struct MyModel : Bellman {
    ⋮
    static decl work;
    ⋮
    }
⋮
Actions(work = new ActionVariable("w",2));
Comments:
If no action variables are added to MyModel then a no-choice action is added by CreateSpaces().

 AuxiliaryOutcomes

static DP :: AuxiliaryOutcomes ( ... )
Add AuxiliaryValues to \(\chi\).
Parameters:
... AuxiliaryValues or static function(s) that take no arugment, which will be sent to StaticAux
or arrays of auxiliary variables and static functions to add to \(\chi\)

See also:
Chi, StaticAux

 Blocks

static decl Blocks [public]
List of StateBlocks added to the model. User code will typically not access this objects except perhaps in a new solution method or other lower-level routine.

 Chi

static decl Chi [public]
list of AuxiliaryValues that depend on the current outcome. Realize() is called by Simulate() after α, ζ and full state vectors have been set.

 ClockType

static decl ClockType [public]
category of clock.
See also:
ClockTypes, SetClock

 counter

static decl counter [public]
counter variable.
See also:
SetClock

 CreateSpaces

static DP :: CreateSpaces ( )
Initialize all spaces.
Comments:
No actions or variables can be added after CreateSpaces() has been called.

 curREdensity

static decl curREdensity [public]
density of current group. Sums to 1.0 over random effects for each fixed effect.

 delta

static decl delta [public]
The discount factor δ.
See also:
SetDelta, CVdelta

 DrawFsamp

static DP :: DrawFsamp ( find , N )
Draw a population count random sample of N values from the random effects distribution.
Parameters:
find index of fixed group
N number of draws to take
Returns:
1xF vector of integer counts that sum to N
See also:
DrawGroup

 DrawGroup

static DP :: DrawGroup ( find )
Draw γ from Γ according to the density. Sets I::g and syncs state variables in γ
Returns:
Γ[gind], for external access to Γ
See also:
DrawOne

 DrawOneExogenous

static DP :: DrawOneExogenous ( aState )
Draw one \(\epsilon\) vector given following \(P(\epsilon)\).
Parameters:
aState address of state vector to insert value
Returns:
index of the simulated \(\epsilon\)

 EndogenousStates

static DP :: EndogenousStates ( ... )
Add StateVariables to the endogenous vector \(\theta\).
Parameters:
... StateVariables to add to \(\theta\)

 EOoE

static decl EOoE [public]
task to integrate outcomes over \(\epsilon\).

 EStoS

static decl EStoS [public]
task to update tomorrow's state distribution.

 ETT

static decl ETT [public]
task to compute endogenous transitions

 ExogenousStates

static DP :: ExogenousStates ( ... )
Add StateVariables to the exogenous vector \(\epsilon\).
Parameters:
... Exogenous StateVariables to add \(\epsilon\)

 gdist

static decl gdist [public]
distriubution over groups

 GetAind

static DP :: GetAind ( i )
Return index into the feasible A list for a θ.
Parameters:
i index of θ in the state space Θ
Returns:
θ.j (Theta[i].Aind)

 GetPinf

static DP :: GetPinf ( g )
Return \(P_\infty(\theta)\).
Parameters:
g group index
UseCurrent (default)
Returns:
Stationary Distribution

 GetPstar

static DP :: GetPstar ( i )
Return choice probability for a \(\theta\) and current \(\gamma\).
Parameters:
i tracking index of \(\theta\) in the state space \(\Theta\)
Returns:
\(P*(\alpha;\epsilon,\eta,\theta,\gamma)\) (Theta[i].pandv)

 GetTrackTrans

static DP :: GetTrackTrans ( i , h )
Return tracking transition at a given \(\eta,\theta\) combination.
Parameters:
i index of \(\theta\) in the state space \(\Theta\)
h index of current \(\eta\) vector
Returns:
\(P(\theta^\prime | \alpha,\eta,\theta)\) as an array
First element is vector of indices for feasible states \(\theta^\prime\)
Second element is a matrix of transition probabilities (rows for actions \(\alpha\), columns correspond to \(\theta^\prime\))

 GetUseEps

static DP :: GetUseEps ( i )

 GroupVariables

static DP :: GroupVariables ( ... )
Add TimeInvariants to the group vector \(\gamma\).
Parameters:
... TimeInvariants to add to \(\gamma\)

 Indicators

static DP :: Indicators ( ivar , prefix , ilo , ihi )
Create auxiliary values that are indicators for a state or action.
Parameters:
ivar state variable or action variable to interact
UseLabel: use abbreviated ivar.L
string: start of column labels for matching to data.
ilo minimum value of ivar to track interaction (default=0)
ihi maximum index to track (default = 100)

For objects in data, tracked moment label must have the form prefix_kk


 Initialize

static DP :: Initialize ( userState , UseStateList )
Initialize static members.
Parameters:
userState a Bellman-derived object that represents one point \(\theta\) in the user's endogenous state space \(\Theta\). The Ox clone() function is used to copy this object to fill out \(\Theta\). This also allows userReachable() to be a virtual function
UseStateList TRUE, traverse the state space \(\Theta\) from a list of reachable indices
FALSE (default), traverse \(\Theta\) through iteration on all state variables

Comments:
Each DDP has its own version of Initialize, which will call this as well as do further set up.

MyModel MUST call DPparent::Initialize before adding any variables to the model.

UseStateList=TRUE may be much faster if the untrimmed state space is very large compared to the trimmed (reachable) state space.


 Interactions

static DP :: Interactions ( ivar , olist , prefix , ilo , ihi )
Create and return a list of auxiliary values for interactions.
Parameters:
ivar state variable or action variable to interact
olist Unitialized, no interaction
list of objects to interact with indicators for ivar
UseLabel: use abbreviated ivar.L
string: start of column labels for matching to data.
ilo minimum value of ivar to track interaction (default=0)
ihi maximum index to track (default = 100)

For objects in data, tracked moment label must have the form prefix_kk_xlabbrev

kk: current (not actual) value of ivar with a leading 0 xlabbrev: abbreviated label of member of olist (max 4 characters)


 IOE

static decl IOE [public]
task to integrate V over semi-exogenous states.

 KLaggedAction

static DP :: KLaggedAction ( Target , K , Prune )
Create a K-array of lagged values of an action variable.
Parameters:
L label
Target ActionVariable to track
K positive integer, number of lags to track
Prune TRUE [default] if clock is finite horizon, presume all lags initialize to 0 and prune unreachable values.

Returns:
K-array, of the lagged values of Target
Example:
Create a binary choice. Add 3 lags of it to θ
d = new BinaryChoice("d");
status = KLaggedState(d,3);
EndogenousStates(status);

 KLaggedState

static DP :: KLaggedState ( Target , K , Prune )
Create an K+1-array of a state variable and K lags of its values.
Parameters:
L label
Target StateVariable to track
K positive integer, number of lags to track
Prune TRUE [default] if clock is finite horizon, presume all lags initialize to 0 and prune unreachable values.
Returns:
K+1 - array, where the first element is the Target and the rest of the lagged values
Example:
Create a binary Markov process and 3 lags, add all of them to θ
status = KLaggedState(new Markov("q",<0.9,0.2;0.1,0.8>),3));
EndogenousStates(status);

 L

static decl L [public]
Label for the problem.

 logf

static decl logf [public]
file for diagnostic output.

 lognm

static decl lognm [public]
dated file name for diagnostic output

 MakeGroups


 MultiInteractions

static DP :: MultiInteractions ( ivarlist , ilov , ihiv , olist , prefix )
Create and return a list of auxiliary values for interactions.
Parameters:
ivar state variable or action variable to interact
olist Unitialized, no interaction
list of objects to interact with indicators for ivar
UseLabel: use abbreviated ivar.L
string: start of column labels for matching to data.
ilo minimum value of ivar to track interaction (default=0)
ihi maximum index to track (default = 100)

For objects in data, tracked moment label must have the form prefix_kk_xlabbrev

kk: current (not actual) value of ivar with a leading 0 xlabbrev: abbreviated label of member of olist (max 4 characters)


 MyVersion

static decl MyVersion [public]
Version of niqlow that code is written for.
See also:
SetVersion

 NKptrans

static decl NKptrans [public]
shared space for N-K iteration.

 NKvindex

static decl NKvindex [public]

 NxtExog

static decl NxtExog [public]
Array of Exogenous next state indices and transitions.

 onlyDryRun

static DP :: onlyDryRun ( )
For debugging: Set a flag so that CreateSpaces does not actually create the space.

 parents

static decl parents [public]
List of parent classes.

 RecomputeTrans

static DP :: RecomputeTrans ( )
If changing fixed parameters and UpdateTime==WhenFlagIsSet then next Solve() will recompute transitions.

 S

static decl S [public]
array of Spaces, using SubVectorNames as names for elements. User code will typically not access this objects except perhaps in a new solution method or other lower-level routine.

 SemiExogenousStates

static DP :: SemiExogenousStates ( ... )
Add StateVariables to the semiexogenous vector \(\eta\).
Parameters:
... Semi-exogenous StateVariables to add to \(\eta\)

 SetClock

static DP :: SetClock ( ClockOrType , ... )
Set the model clock.
Parameters:
ClockOrType Clock derived state block
integer, ClockTypes
... arguments to pass to constructor of clock type

Example:
Initialize(Reachable);
SetClock(InfiniteHorizon);
⋮
CreateSpaces();
Finite Horizon
decl T=65;	
Initialize(Reachable);
SetClock(NormalAging,T);
⋮
CreateSpaces();
Early Mortaliy
MyModel::Pi();	

SetClock(RandomMortality,T,MyModel::Pi); Initialize(Reachable); ⋮ CreateSpaces();

Comments:
MyModel can also create a derived Clock and pass it to SetClock.

 SetDelta

static DP :: SetDelta ( delta )
Set the discount factor, \(\delta\).
Parameters:
delta, CV compatible object (Parameter or double or function)

 Settheta

static DP :: Settheta ( endogind )
Sets the current θ.
Parameters:
endogind tracking index of the state θ.
Returns:
TRUE if θ is reachable. FALSE otherwise.
See also:
curth

 SetUpdateTime

static DP :: SetUpdateTime ( time )
Tell DDP when parameters and transitions have to be updated.
Parameters:
time UpdateTimes [default=AfterRandom]

THe default allows for transitions that depend on dynamically determined parameters, and the current value of FixedEffect variables (if there are any), and RandomEffect variables (if there are any).

Example:
MyModel is simpler than the default: it has no dynamically determined parameters, so transitions can calculated once-and-for-all when spaces are created:
⋮
SetUpdateTime(InCreateSpaces);  //have to tell me before you call CreateSpaces!
CreateSpaces();
MyModel is still simpler than the default, but its transitions do depend on dynamic parameters (say an estimated parameter). So transitions have to be updated each time all solutions are initiated by Solve() and can't just be done in CreateSpaces.
⋮
CreateSpaces();
SetUpdateTime(OnlyOnce);   // can be set after CreateSpaces
MyModel is still simpler than the default, but its transitions do depend on the values of FixedEffects. RandomEffects do not affect transitions, only utility so transitions do not have to be updated with each change in random effects:
⋮
CreateSpaces();
SetUpdateTime(AfterFixed);


 SetVersion

static DP :: SetVersion ( v )
Checks the version number you send with the current version of niqlow.
Parameters:
v integer [default=200]

 SS

static decl SS [public]
array of `SubSpaces .

 States

static decl States [public]
List of State Variables added to the model. User code will typically not access this objects except perhaps in a new solution method or other lower-level routine. Variables are added to this list in the order they were added during execution.

 StorePalpha

static DP :: StorePalpha ( )
Ask to store overall \(P*()\) choice probability matrix.
Comments:
Can only be called before calling CreateSpaces

 SubSampleStates

static DP :: SubSampleStates ( SampleProportion , MinSZ , MaxSZ )
Request that the State Space be subsampled for extrapolation methods such as KeaneWolpin.
Parameters:
SampleProportion 0 < double ≤ 1.0, fixed subsample size across t
N::T×1 vector, time-varying sampling proportions.
[default] 1.0: do not subsample at all, visit each state.

MinSZ minimum number of states to sample each period [default=0]
MaxSZ maximum number of states to sample each period [default=INT_MAX, no maximum]

Example:
Suppose that N::T=4
SubSampleStates(<1.0;0.9;0.75;0.5>);
This will sample half the states in the last period, 3/4 of the states in period 2, 90% in period 1 and all the states in period 0.
SubSampleStates(1.0,0,100);
This will ensure that more than 100 states are subsampled each period. If there are fewer reachable states than 100 at t then all states are sampled and the solution is exact.
SubSampleStates(0.8,30,200);
This will sample 80% of states at all periods, but it will guarantee that no fewer than 30 and no more than 200 are sampled in any one period.

Notes
If called before CreateSpaces() the subsampling actually occurs during CreateSpaces().

If called after CreateSpaces() then the new sampling scheme occurs immediately. Storage for U and Ρ() is re-allocated accordingly.

 SubVectors

static decl SubVectors [public]
List of variables by vector.
See also:
SubVectorNames

 SyncAct

static DP :: SyncAct ( a )
Ensure that ActionVariable current values (v) is synched with the choice vector \(\alpha\).
Parameters:
a action vector.

 tod

static decl tod [public]
Outcomes sent to StateToStatePrediction

 tom

static decl tom [public]

 UpdateDistribution


 userState

static decl userState [public]
copy of user's Bellman object used for cloning.

 ValuesCounters

static DP :: ValuesCounters ( L , Target , MaxCounts , Prune )
Create an array of counters for different values of a state or action variable.
Parameters:
L label
Target StateVariable or ActionVariable to track with N-1 values
MaxCounts N-vector where
0 means do not track that value. In this case, the corresponding state is Fixed
M>0, max count to keep.
Prune TRUE [default] if clock is finite horizon, then all but the last will be set as not PRUNED; the first counted value will be a special state counter that stores the array and checks reachability for all of them.
Returns:
array of state variables, Fixed and StateCounter.
Example:
If m is state with 4 values, this will track values 1,2, and 3 up to limits of 8,20,20.
mcount = new StateValuesCounters("M",<0,8,20,20>,TRUE));
EndogenousStates(status);

 Volume

static decl Volume [public]
Output level.
See also:
NoiseLevels

 XUT

static decl XUT [public]
task to compute utility over exogenous states.

 DPDebug

 div

static const decl div [public]

 DPDebug

DPDebug :: DPDebug ( )

 ndone

static decl ndone [public]

 OutAll

static decl OutAll [public]

 outAllV

static DPDebug :: outAllV ( ToScreen , aM , MaxChoiceIndex , TrimTerminals , TrimZeroChoice )
Print the table of value functions and choice probabilities for all fixed effect groups.
Parameters:
ToScreen TRUE means output is displayed.
aM address to return matrix
0, do not save
MaxChoiceIndex FALSE = print choice probability vector (default)
TRUE = only print index of choice with max probability. Useful when the full action matrix is very large.
TrimTerminals TRUE means states marked as Type terminal are deleted
TrimZeroChoice TRUE means states with no choice are deleted

Example:
Print out everthing to the screen once model is solved:
   ⋮
   CreateSpaces();
   meth = new ValueIteration();
   DPDebug::outAllV();
   meth->Solve();
Store everthing to a matrix without printing to the screen:
   decl av;
   ⋮
   DPDebug::outAllV(FALSE,&av);
If after solving the model you want to save the output table in an external file with labels for the columns use Ox's savemat() routine and SVlabels:
   ⋮
   meth->Solve();
   savemat("v.dta",av,DPDebug::SVlabels);
Print to screen only highest-probability choice index (not all probabilities) for non-terminal states with a real choice:
   DPDebug::outAllV(TRUE,FALSE,TRUE,TRUE,TRUE);

the screen once model is solved:

The tables for individual fixed effect groups are concatenated together if aM is an address. On the screen the tables are printed out separately for each fixed effect.
See also:
outV

 outV

static DPDebug :: outV ( ToScreen , aM , MaxChoiceIndex , TrimTerminals , TrimZeroChoice )
For the current fixed-effect group, print the value function \(EV(\theta)\) and choice probability \(P^\star(\alpha;\epsilon,\eta,\theta)\) or index of max \(P^\star\).
Parameters:
ToScreen TRUE means output is displayed.
aM address to return matrix
0, do not save
MaxChoiceIndex FALSE = print choice probability vector (default)
TRUE = only print index of choice with max probability. Useful when the full action matrix is very large.

The columns of the matrix are:

StateIndex IsTerminal Aindex EndogenousStates t REIndex FEIndex EV Ρ(α)'
and
Column                Definition
---------------------------------------------------------------------------------------
StateIndex            Integer index of the state in the endogenous state space Θ
IsTerminal            The state is terminal, see TermValues
Aindex                The index of the feasible action set, A(θ)
EndogenousStates      The value of the endogenous state variables at θ
t                     The time variable, see SetClock and t.
REIndex               The index into the random effect state space
FEIndex               The index into the fixed effect state space
EV                    EV(θ) integrating over any exogenous (ε) or
                      semi-exogenous (η) state variables.
Pinf                  The stationary distribution if the clock is ergodic
P*                    The conditional choice probability vector (transposed into a column
                      and expanded out to match the full potential action matrix.
                      (or if MaxChoiceIndex just the index with the highest
                      choice probability.

Comments:
When a solution Volume is set to LOUD this function is called after each fixed effect group is complete.
See also:
outAllV

 prtfmt

static decl prtfmt [public]

 prtfmt0

static decl prtfmt0 [public]

 rp

static decl rp [public]

 SimLabels

static decl SimLabels [public]

 SVlabels

static decl SVlabels [public]

 Vlabel0

static decl Vlabel0 [public]

 DumpExogTrans

 DumpExogTrans

DumpExogTrans :: DumpExogTrans ( )
Display the exogenous transition as a matrix.

 s

decl s [public]

 EndogTrans

 EndogTrans


 Transitions

 ExogOutcomes

 auxlist

static decl auxlist [public]

 chq

static decl chq [public]

 ExpectedOutcomes

ExogOutcomes :: ExpectedOutcomes ( howmany , chq )
Compute the expected values of tracked auxiliary variables over the exogenous vector ε

 tmp

static decl tmp [public]

 ExogUtil

 AnyExog

const decl AnyExog [public]
indicate there are exogenous variabes so loop is required.

 Run

ExogUtil :: Run ( )

 U

decl U [public]
stores Utility matrix for current \(\theta\).

 FETask

 ~FETask

FETask :: ~ FETask ( )

 Group

 Density

Group :: Density ( )
Compute density of current group \(\gamma\) conditional on fixed effects.

 DrawfromStationary

Group :: DrawfromStationary ( )
Draw \(\theta\) from \(P_\infty(\theta)\) for current \(\gamma\).
Returns:
state vector
See also:
DrawOne

 find

decl find [public]
Index into fixed effects

 IncPtrans

Group :: IncPtrans ( et , h )

 mobj

decl mobj [public]
method specific object.

 Palpha

decl Palpha [public]
Expand Choice Prob matrix.

 Pinfinity

decl Pinfinity [public]
Stationary distribution \(P_\infty\) for ergodic clock models.
See also:
DP::GetInf

 pos

decl pos [public]
Position in \(\Gamma\).

 Ptrans

decl Ptrans [public]
State-to-State transition.

 Reset

Group :: Reset ( )
Reset a group. This resets Ptrans[Ρ(θ′;θ)] and it synch γ
Parameters:
gam , γ group to reset.
Returns:
density of the the group.
See also:
SetGroup

 rind

decl rind [public]
Index into random effects

 state

decl state [public]
Group's state vector.

 StationaryDistribution

Group :: StationaryDistribution ( )
Compute the stationary distribution over reachable states, \(P_\infty(\theta)\).
See also:
Pinfinity

 GroupTask

 qtask

decl qtask [public]
sub task.

 span

const decl span [public]

 ~GroupTask

GroupTask :: ~ GroupTask ( )

 I

 SetGroup

I :: SetGroup ( GorSV )
Set the current group.
Parameters:
GorSV UseCurrent [default] all[bothgroup] already set
Other integer: set all[bothgroup]
state vector: set groupoffs using I::OO Not usually called from user code.
Returns:
pointer to group in the group space.

 N

 picked

N :: picked ( )

 SubSample

N :: SubSample ( )

 SubSampleDone

N :: SubSampleDone ( )

 OutAuto

 OutAuto

OutAuto :: OutAuto ( )

 RandomEffectsIntegration

 flat

decl flat [public]

 Integrate

RandomEffectsIntegration :: Integrate ( path )
Integrate over \(\gamma_r\).
Parameters:
path Observed path to integrate likelihood over random effects for.
Returns:
array {L,flat}, where L is the path objective, integrating over random γ and flat is the integrated flat output of the path.

 L

decl L [public]
cumulative likelihood or other outcome.

 path

decl path [public]
The path object I am processing.

 RandomEffectsIntegration

RandomEffectsIntegration :: RandomEffectsIntegration ( )
.

 ReSubSample

 ReSubSample

ReSubSample :: ReSubSample ( )

 RETask

 fixl

const decl fixl [public]

 fixr

const decl fixr [public]

 SaveV

 aM

const decl aM [public]

 MaxChoiceIndex

const decl MaxChoiceIndex [public]

 nottop

decl nottop [public]

 r

decl r [public]

 s

decl s [public]

 SaveV

SaveV :: SaveV ( ToScreen , aM , MaxChoiceIndex , TrimTerminals , TrimZeroChoice )
Save the value function as a matrix and/or print.
Parameters:
ToScreen TRUE, print to output (default)
aM = 0 do not save to a matrix (default)
address to save too
MaxChoiceIndex = FALSE print choice probability vector (default)
= TRUE only print index of choice with max probability. Useful when the full action matrix is very large.

 stub

decl stub [public]

 ToScreen

const decl ToScreen [public]

 TrimTerminals

const decl TrimTerminals [public]

 TrimZeroChoice

const decl TrimZeroChoice [public]

 SemiExTask

 AnyEta

const decl AnyEta [public]
indicate there are \(\eta\) variables so loop is required.

 CurrExogWidth

decl CurrExogWidth [public]

 Run

 Space

 Append


 C

decl C [public]
cumulative product of N.

 D

decl D [public]
dimension of the space.

 M

decl M [public]
Min indices of var group in state vector.

 N

decl N [public]
# of values state variables take on.

 size

decl size [public]
product of VN over VM[] to VX[].

 Space

Space :: Space ( )
Tracks information about a subvector of the state vector.

 X

decl X [public]
maX indices of var group in state vector.

 SubSpace

 ClockIndex

static decl ClockIndex [public]
location of the clock object.

 D

decl D [public]
# of dimensions

 left

decl left [public]
leftmost state index.

 O

decl O [public]
vector of offsets

 right

decl right [public]
rightmost state index

 S

static decl S [public]
shared spaces

 size

decl size [public]
# of elements

 SubSpace

SubSpace :: SubSpace ( )
Tracks information about a set of one or more Spaces.

 ~SubSpace

SubSpace :: ~ SubSpace ( )

 SVT

 Slist

decl Slist [public]

 SVTrans

 Slist

decl Slist [public]

 SVTrans

 Task

 caller

const decl caller [public]
Task that called me (used by methods).

 d

decl d [public]
index into state of current spanning dimension.

 done

decl done [public]
Indicates task is done (may require one more trip).

 inner

decl inner [public]
keep going ... mimics an inner do while().

 itask

decl itask [public]
Inner task for a stack of tasks to perform.

 iter

decl iter [public]
Times Run() called while in progress.

 L

decl L [public]
Label for debugging purposes.

 left

const decl left [public]
leftmost variable in state to loop over

 list

virtual Task :: list ( span , inlows , inups )
Process a vector (list) of state indices.
Parameters:
DoAll go through all reachable states
non-negative integer, initial t
var0
non-negative integer, the time period to loop over
lohi matrix of first and last index to process

 MaxTrips

decl MaxTrips [public]
max number of outer trips

 right

const decl right [public]
rightmost variable in state to loop over

 state

decl state [public]
N×1 vector, current values of all states.

 subspace

decl subspace [public]
subspace to use for indexing during the task

 SyncStates

Task :: SyncStates ( dmin , dmax )
Ensure that all StateVariable objects v are synched with the internally stored state vector.
Parameters:
dmin leftmost state variable
dmax rightmost state variable
Returns:
the value of the dmax (rightmost)
Comments:
If the clock is within the range of states to synch then Synch() is called at the end.

 trace

static decl trace [public]

 trips

decl trips [public]
Trips through the task's space.

 ~Task

Task :: ~ Task ( )