Overview
This page provides an overview of the API along with examples.
Make Predictions
The quantum prisoner's dilemma model (QPDM) generates predictions for three conditions:
- Player 1 is told that player 2 defected
- Player 1 is told that player 2 cooperated
- Player 1 is not informed of the action of player 2
using QuantumPrisonersDilemmaModel
model = QPDM(;μd=.51, γ=2.09)
predict(model)
3-element Vector{Float64}:
0.8057112841924796
0.6487381658136033
0.5652813506885033
Simulate Model
The code block below demonstrates how to generate simulated data from the model using rand
. In the example, we will generate 100 simulated trials for each condition.
using QuantumPrisonersDilemmaModel
model = QPDM(;μd=.51, γ=2.09)
data = rand(model, 100)
3-element Vector{Int64}:
88
67
61
Evaluate Log Likelihood
The log likelihood of data can be evaluated using logpdf
. In the code block below, we generate simulated data and evaluate the logpdf:
using QuantumPrisonersDilemmaModel
model = QPDM(;μd=.51, γ=2.09)
n_trials = 100
data = rand(model, n_trials)
logpdf(model, n_trials, data)
-10.446363596913525