drawing

Constructors

TrueAndErrorModels.TrueErrorModelType
TrueErrorModel{T <: Real} <: AbstractTrueErrorModel{T}

A model object for a True and Error Model of Allias Paradox. Two choice sets are presented twice during the same session, meaning 4 choices are made in total. Subscript r represents risky, subscript s represents safe, and subscripts 1 and 2 represent choice set. For example, pᵣᵣ represents the probability of truely prefering the risky option in both choice sets and ϵₛ₁ represents the error probability of choosing safe given a true preference for risky in first choice set.

Fields

  • p::AbstractVector{T}: a vector of true preference state probabilities with elements p = [pᵣᵣ, pᵣₛ, pₛᵣ, pₛₛ], such that sum(p) = 1.
  • ϵ::AbstractVector{T}: a vector of error probabilities with elements ϵ = [ϵₛ₁, ϵₛ₂, ϵᵣ₁, ϵᵣ₂].

Constructors

TrueErrorModel(p, ϵ)

TrueErrorModel(; p, ϵ)

Example

using TrueAndErrorModels

dist = TrueErrorModel(; p = [0.60, .30, .05, .05], ϵ = fill(.10, 4))
data = rand(dist, 200)
logpdf(dist, data)

Documentation

Full documentation can be found at https://itsdfish.github.io/TrueAndErrorModels.jl/dev/

References

Birnbaum, M. H., & Quispe-Torreblanca, E. G. (2018). TEMAP2. R: True and error model analysis program in R. Judgment and Decision Making, 13(5), 428-440.

Lee, M. D. (2018). Bayesian methods for analyzing true-and-error models. Judgment and Decision Making, 13(6), 622-635.

source

Core Functions

TrueAndErrorModels.compute_probsFunction
compute_probs(dist::AbstractTrueErrorModel{T})

Computes the joint probability for all 16 response categories

Arguments

  • dist::AbstractTrueErrorModel{T}: a distribution object for a True and Error Model for two choices sets, each containing

a risky option R and a safe option S.

Output

  • θ::Vector{T}: vector of joint response probabilities with the following elements:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
Distributions.logpdfFunction
logpdf(dist::AbstractTrueErrorModel, data::AbstractVector{<:Integer})

Computes the log loglikelihood of the data for a True and Error Model.

Arguments

  • dist::AbstractTrueErrorModel{T}: a distribution object for a True and Error Model for two choices sets, each containing a risky option R and a safe option S.
  • data::AbstractVector{<:Integer}: a vector of response pattern frequencies. The elements of this vector are ordered as follows:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
Base.randFunction
rand(dist::AbstractTrueErrorModel, n_trials::Int)

Generate a vector of simulated response frequencies based on the provided True and Error Model.

  • dist::AbstractTrueErrorModel{T}: a distribution object for a True and Error Model for two choices sets, each containing

a risky option R and a safe option S.

  • n_trials: the number of simulated trials

Output

  • data::Vector{<:Integer}: vector of joint response frequencies with the following elements:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source

Off-the-shelf Turing Models

TrueAndErrorModels.tet1_modelFunction
tet1_model(data::Vector{<:Integer})

A True and Error Theory model with one error parameter: ϵₛ₁ = ϵₛ₂ = ϵᵣ₁ = ϵᵣ₂

Arguments

  • data::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
TrueAndErrorModels.tet2_modelFunction
tet2_model(data::Vector{<:Integer})

A True and Error Theory model with two error parameters: ϵₛ₁ = ϵᵣ₁, ϵₛ₂ = ϵᵣ₂

Arguments

  • data::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
TrueAndErrorModels.tet4_modelFunction
tet4_model(data::Vector{<:Integer})

A True and Error Theory model with four error parameters: ϵₛ₁, ϵᵣ₁, ϵₛ₂, ϵᵣ₂

Arguments

  • data::Vector{<:Integer}::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
TrueAndErrorModels.eut1_modelFunction
eut1_model(data::Vector{<:Integer})

An expected utility theory model with one error parameter: ϵₛ₁ = ϵₛ₂ = ϵᵣ₁ = ϵᵣ₂. The preference states of all expected utility theory models are subject to the constraint that pᵣₛ = pₛᵣ = 0.

Arguments

  • data::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
TrueAndErrorModels.eut2_modelFunction
eut2_model(data::Vector{<:Integer})

An expected utility theory model with two error parameters: ϵₛ₁ = ϵᵣ₁, ϵₛ₂ = ϵᵣ₂. The preference states of all expected utility theory models are subject to the constraint that pᵣₛ = pₛᵣ = 0.

Arguments

  • data::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source
TrueAndErrorModels.eut4_modelFunction
eut4_model(data::Vector{<:Integer})

An expected utility theory model with four error parameters: ϵₛ₁, ϵᵣ₁, ϵₛ₂, ϵᵣ₂. The preference states of all expected utility theory models are subject to the constraint that pᵣₛ = pₛᵣ = 0.

Arguments

  • data::Vector{<:Integer}: a vector of response frequencies in which elements corrspond to the following response patterns:
  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS

where S corresponds to choosing the safe option, R corresponds to choosing the risky option, each pair (XX) is the joint choice for choice sets 1 and two, respectively for a given replication. The first pair corresponds to the first replication, and the second pair corresponds to the second replication. For example, SR,RS indicates the selection of the safe option for choice set 1 followed by the risky option for choice set 2 during the first replication, and the reversal of choices for the second replication.

source

Predictive Distributions

Missing docstring.

Missing docstring for predict_distribution. Check Documenter's build log for details.

Utilities

TrueAndErrorModels.to_tableFunction
to_table(x::Vector{<:Real})

Converts a vector of response frequencies or catetory probabilities to a 4X4 table in which the columns correspond to joint responses on the first replicate and the rows correspond to the joint responses on the second replicate. Labels S correspond to safe option and R corresponds to risky option. The position of elements corresponds to choice set.

Arguments

x::Vector{<:Real}: a vector of response frequencies or catetory probabilities with the following elements:

  1. RR,RR
  2. RR,RS
  3. RR,SR
  4. RR,SS
  5. RS,RR
  6. RS,RS
  7. RS,SR
  8. RS,SS
  9. SR,RR
  10. SR,RS
  11. SR,SR
  12. SR,SS
  13. SS,RR
  14. SS,RS
  15. SS,SR
  16. SS,SS
source