pyblp.ImportanceSamplingResults

class pyblp.ImportanceSamplingResults

Results of importance sampling.

Along with the sampled agents, these results also contain a number of useful importance sampling diagnostics from Owen (2013).

The ImportanceSamplingResults.to_problem() method can be used to update the original Problem with the importance sampling agent data.

problem_results

ProblemResults that was used to compute these importance sampling results.

Type

ProblemResults

sampled_agents

Importance sampling agent data structured as Agents. The data_to_dict() function can be used to convert this into a more usable data type.

Type

Agents

computation_time

Number of seconds it took to do importance sampling.

Type

float

draws

Number of importance sampling draws in each market.

Type

int

diagnostic_market_ids

Market IDs the correspond to the ordering of the following arrays of weight diagnostics.

Type

ndarray

weight_sums

Sum of weights in each market: \(\sum_i w_{it}\). If importance sampling was successful, weights should not sum to numbers too far from one.

Type

ndarray

effective_draws

Effective sample sizes in each market: \(\frac{(\sum_i w_{it})^2}{\sum_i w_{it}^2}\).

Type

ndarray

effective_draws_for_variance

Effective sample sizes for variance estimates in each market: \(\frac{(\sum_i w_{it}^2)^2}{\sum_i w_{it}^4}\).

Type

ndarray

effective_draws_for_skewness

Effective sample sizes for gauging skewness in each market: \(\frac{(\sum_i w_{it}^2)^3}{(\sum_i w_{it}^3)^2}\).

Type

ndarray

Examples

Methods

to_dict([attributes])

Convert these results into a dictionary that maps attribute names to values.

to_problem()

Re-create the problem with the agent data constructed from importance sampling.