Skip to content

Commit

Permalink
update type system
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdfish committed Sep 30, 2023
1 parent 02bd121 commit bcb8c9a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SequentialSamplingModels"
uuid = "0e71a2a6-2b30-4447-8742-d083a85e82d1"
authors = ["itsdfish"]
version = "0.7.1"
version = "0.7.2"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
9 changes: 7 additions & 2 deletions docs/src/bayes_factor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ In this tutorial, we will use the Bayes factor to compare the evidence for one m
In the tutorial below, we will compare two models which differ only in terms of assumptions about drift rate variability: the LBA and the RDM. The LBA assumes that the drift rate varies across trials and is otherwise deterministic, whereas the RDM assumes the drift rate varies within a trial as Gaussian noise, but not across trials. The difference between the models can be visualized with SSMPlots.jl:

### RDM
```@setup bayes_factor
using Random
using SequentialSamplingModels
using SSMPlots
```

```julia
```@example bayes_factor
using SequentialSamplingModels
using SSMPlots
using Random
Expand All @@ -20,7 +25,7 @@ density_kwargs=(;t_range=range(.20, 1.0, length=100),)
plot_model(dist; n_sim=1, density_kwargs, xlims=(0,1.0))
```
### LBA
```julia
```@example bayes_factor
using SequentialSamplingModels
using SSMPlots
using Random
Expand Down
1 change: 1 addition & 0 deletions src/SequentialSamplingModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module SequentialSamplingModels
import StatsAPI: params

export AbstractaDDM
export AbstractCDDM
export AbstractLBA
export AbstractLCA
export AbstractLNR
Expand Down
6 changes: 5 additions & 1 deletion src/type_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct Approximate <: PDFType end

get_pdf_type(d::SSM1D) = Exact
get_pdf_type(d::SSM2D) = Exact
get_pdf_type(d::ContinuousMultivariateSSM) = Exact

minimum(d::SSM1D) = 0.0
maximum(d::SSM1D) = Inf
Expand All @@ -94,6 +95,7 @@ insupport(d::SSM2D, data) = data.rt ≥ minimum(d) && data.rt ≤ maximum(d)

Base.broadcastable(x::SSM1D) = Ref(x)
Base.broadcastable(x::SSM2D) = Ref(x)
Base.broadcastable(x::ContinuousMultivariateSSM) = Ref(x)

vectorize(d::SSM2D, r::NamedTuple) = [r...]
reconstruct(d::SSM2D, v::NamedTuple) = deepcopy(v)
Expand Down Expand Up @@ -185,4 +187,6 @@ Returns 1 for the number of choice options
- `d::SSM1D`: a sub-type of `SSM1D`
"""
n_options(d::SSM1D) = 1
n_options(d::SSM1D) = 1

n_options(d::ContinuousMultivariateSSM) = length(d.ν)

0 comments on commit bcb8c9a

Please sign in to comment.