API Reference
This reference is generated automatically from the package docstrings via mkdocstrings.
Top-level package
CircularDiffusionModel(threshold_dynamic='fixed')
Circular Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Circular.py
14 15 16 17 18 19 20 21 22 23 24 25 26 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
array - like
|
Response times |
required |
theta
|
array - like
|
Choice angles in radians |
required |
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The initial decision threshold |
required |
decay
|
float
|
The decay rate of the threshold (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Type | Description |
|---|---|
array - like
|
The joint log-probability density evaluated at (rt, theta) with same shape as rt and theta |
Source code in src/jeam/Models/Circular.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Circular Diffusion Model with collapsing boundaries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The initial decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The decay rate of the threshold (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
The time step for simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
The number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Circular.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
HyperSphericalDiffusionModel(threshold_dynamic='fixed')
Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/HyperSpherical.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 3))
|
The choice angles in spherical coordinates (theta1, theta2, theta3) |
required |
drift_vec
|
(array - like, shape(4) or (n_samples, 4))
|
The drift rates in each dimension |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(4) or (n_samples, 4))
|
The drift rates in each dimension |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
ProjectedHyperSphericalDiffusionModel(threshold_dynamic='fixed')
Projected Hyper-Spherical Diffusion Model
Source code in src/jeam/Models/HyperSpherical.py
298 299 300 301 302 303 304 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles for the Projected Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 2))
|
The choice angles in spherical coordinates (theta1, theta2) |
required |
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift rates in each dimension |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Projected Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift vector [drift_x, drift_y, drift_z]. Note that drift_z must be non-negative, as it represents the projection onto the upper hemisphere. |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
ProjectedSphericalDiffusionModel(threshold_dynamic='fixed')
Projected Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Spherical.py
291 292 293 294 295 296 297 298 299 300 301 302 303 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples))
|
The choice angles in radians |
required |
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angle |
Source code in src/jeam/Models/Spherical.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate response times and choices from the Projected Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y]. Note that drift_y must be non-negative, as it represents the projection onto the upper half-plane. |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Spherical.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
SphericalDiffusionModel(threshold_dynamic='fixed')
Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Spherical.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 2))
|
The choice angles in spherical coordinates (theta1, theta2) |
required |
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift rates in each dimension |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/Spherical.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
Drift vector; a three-dimensional array |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
Non-decision time; a positive floating number |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
Decision threshold; a positive floating number (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
Decay rate of the collapsing boundary (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Spherical.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
iv_numba(v, x)
Modified Bessel function of the first kind I_v(x) for real v and real x. Uses series for small x and asymptotic for large x.
WARNING: I_v(x) grows like exp(x)/sqrt(x), so iv_numba will overflow to inf for sufficiently large x (around x > ~709 in float64).
Source code in src/jeam/utility/helpers.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
ive_numba(v, x)
Exponentially scaled modified Bessel I: ive(v,x) = exp(-abs(x)) * I_v(x) for real v and real x.
This implementation assumes x >= 0 for best behavior.
Source code in src/jeam/utility/helpers.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
load_fennell2023()
Load data from experiment one in Fennell and Ratcliff (2023).
Returns:
| Type | Description |
|---|---|
DataFrame
|
A dataframe containing the data with columns: 'subjectNumber', 'blockNumber', 'trialNumber', 'rt', 'numberOfStimulus', 'responseError' |
Source code in src/jeam/utility/datasets.py
13 14 15 16 17 18 19 20 21 22 | |
load_kvam2019()
Load data from Kvam et al. (2019).
Returns:
| Type | Description |
|---|---|
DataFrame
|
A dataframe containing the data with columns: |
Source code in src/jeam/utility/datasets.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
simulate_CDM_trial(threshold, drift_vec, ndt, threshold_dynamic='fixed', decay=0, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the circular diffusion model (CDM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
A positive floating number representing the decision threshold. |
required |
drift_vec
|
(array_like, shape(2))
|
A two-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
threshold_dynamic
|
(fixed, linear, exponential, hyperbolic)
|
Type of threshold collapse. Default is 'fixed'. |
'fixed'
|
decay
|
float
|
Decay rate of the collapsing boundary. Default is 0. |
0
|
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
float
|
Response angle between [-pi, pi]. |
Source code in src/jeam/utility/simulators.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
simulate_HSDM_trial(threshold, drift_vec, ndt, threshold_dynamic='fixed', decay=0, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the hyper spherical diffusion model (HSDM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
A positive floating number representing the decision threshold. |
required |
drift_vec
|
(array_like, shape(4))
|
A four-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
threshold_dynamic
|
(fixed, linear, exponential, hyperbolic)
|
Type of threshold collapse. Default is 'fixed'. |
'fixed'
|
decay
|
float
|
Decay rate of the collapsing boundary. Default is 0. |
0
|
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2, theta3); theta[0] and theta[1] between [0, pi], and theta[2] between [-pi, pi] |
Source code in src/jeam/utility/simulators.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
simulate_PHSDM_trial(threshold, drift_vec, ndt, threshold_dynamic='fixed', decay=0, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the projected hyper spherical diffusion model (PHSDM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
A positive floating number representing the decision threshold. |
required |
drift_vec
|
(array_like, shape(3))
|
A three-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
threshold_dynamic
|
(fixed, linear, exponential, hyperbolic)
|
Type of threshold collapse. Default is 'fixed'. |
'fixed'
|
decay
|
float
|
Decay rate of the collapsing boundary. Default is 0. |
0
|
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2); theta[0] and theta[1] between [0, pi] |
Source code in src/jeam/utility/simulators.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
simulate_PSDM_trial(threshold, drift_vec, ndt, threshold_dynamic='fixed', decay=0, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the projected spherical diffusion model (PSDM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
A positive floating number representing the decision threshold. |
required |
drift_vec
|
(array_like, shape(2))
|
A two-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
threshold_dynamic
|
(fixed, linear, exponential, hyperbolic)
|
Type of threshold collapse. Default is 'fixed'. |
'fixed'
|
decay
|
float
|
Decay rate of the collapsing boundary. Default is 0. |
0
|
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
float
|
Response angle between [0, pi] |
Source code in src/jeam/utility/simulators.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
simulate_SDM_trial(threshold, drift_vec, ndt, threshold_dynamic='fixed', decay=0, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the spherical diffusion model (SDM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
A positive floating number representing the decision threshold. |
required |
drift_vec
|
(array_like, shape(3))
|
A three-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
threshold_dynamic
|
(fixed, linear, exponential, hyperbolic)
|
Type of threshold collapse. Default is 'fixed'. |
'fixed'
|
decay
|
float
|
Decay rate of the collapsing boundary. Default is 0. |
0
|
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2); theta[0] between [0, pi] and theta[1] between [-pi, pi] |
Source code in src/jeam/utility/simulators.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
simulate_custom_threshold_CDM_trial(threshold_function, drift_vec, ndt, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the circular diffusion model (CDM) with a user defined threshold function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_function
|
callable
|
A function that takes time t and returns the threshold at time t. |
required |
drift_vec
|
(array_like, shape(2))
|
A two-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
drift_vec
|
(array_like, shape(2))
|
A two-dimensional array representing the drift vector. |
required |
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
float
|
Response angle between [-pi, pi]. |
Source code in src/jeam/utility/simulators.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
simulate_custom_threshold_HSDM_trial(threshold_function, drift_vec, ndt, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the hyper spherical diffusion model (HSDM) with a user defined threshold function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_function
|
callable
|
A function that takes time and returns the threshold at that time. |
required |
drift_vec
|
(array_like, shape(4))
|
A four-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2, theta3); theta[0] and theta[1] between [0, pi], and theta[2] between [-pi, pi] |
Source code in src/jeam/utility/simulators.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
simulate_custom_threshold_PHSDM_trial(threshold_function, drift_vec, ndt, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the projected hyper spherical diffusion model (PHSDM) with a user defined threshold function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_function
|
callable
|
A function that takes a time value and returns the threshold at that time. |
required |
drift_vec
|
(array_like, shape(3))
|
A three-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2); theta[0] and theta[1] between [0, pi] |
Source code in src/jeam/utility/simulators.py
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
simulate_custom_threshold_PSDM_trial(threshold_function, drift_vec, ndt, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the projected spherical diffusion model (PSDM) with a user defined threshold function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_function
|
callable
|
A function that takes time and returns threshold. |
required |
drift_vec
|
(array_like, shape(2))
|
A two-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
float
|
Response angle between [0, pi] |
Source code in src/jeam/utility/simulators.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
simulate_custom_threshold_SDM_trial(threshold_function, drift_vec, ndt, s_v=0, s_t=0, sigma=1, dt=0.001)
Simulate a single trial of the spherical diffusion model (SDM) with a user defined threshold function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_function
|
callable
|
A function that takes time t and returns the threshold at time t. |
required |
drift_vec
|
(array_like, shape(3))
|
A three-dimensional array representing the drift vector. |
required |
ndt
|
float
|
A positive floating number representing the non-decision time. |
required |
s_v
|
float
|
Standard deviation of drift rate variability. Default is 0. |
0
|
s_t
|
float
|
Range of non-decision time variability. Default is 0. |
0
|
sigma
|
float
|
Diffusion coefficient (standard deviation of the diffusion process). Default is 1. |
1
|
dt
|
float
|
Time step for the simulation. Default is 0.001. |
0.001
|
Returns:
| Name | Type | Description |
|---|---|---|
rt |
float
|
Response time in seconds. |
theta |
tuple
|
A tuple of response angles (theta1, theta2); theta[0] between [0, pi] and theta[1] between [-pi, pi] |
Source code in src/jeam/utility/simulators.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
trapz_1d(y, x)
Trapezoidal integral of y over x. Both 1D, same length.
Source code in src/jeam/utility/helpers.py
171 172 173 174 175 176 177 178 179 180 | |
Models
Circular diffusion model
CircularDiffusionModel(threshold_dynamic='fixed')
Circular Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Circular.py
14 15 16 17 18 19 20 21 22 23 24 25 26 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
array - like
|
Response times |
required |
theta
|
array - like
|
Choice angles in radians |
required |
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The initial decision threshold |
required |
decay
|
float
|
The decay rate of the threshold (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Type | Description |
|---|---|
array - like
|
The joint log-probability density evaluated at (rt, theta) with same shape as rt and theta |
Source code in src/jeam/Models/Circular.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Circular Diffusion Model with collapsing boundaries
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The initial decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The decay rate of the threshold (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
The time step for simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
The number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Circular.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
Spherical diffusion models
ProjectedSphericalDiffusionModel(threshold_dynamic='fixed')
Projected Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Spherical.py
291 292 293 294 295 296 297 298 299 300 301 302 303 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples))
|
The choice angles in radians |
required |
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y] |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angle |
Source code in src/jeam/Models/Spherical.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate response times and choices from the Projected Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(2) or (n_samples, 2))
|
The drift vector [drift_x, drift_y]. Note that drift_y must be non-negative, as it represents the projection onto the upper half-plane. |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Spherical.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
SphericalDiffusionModel(threshold_dynamic='fixed')
Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/Spherical.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 2))
|
The choice angles in spherical coordinates (theta1, theta2) |
required |
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift rates in each dimension |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/Spherical.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
Drift vector; a three-dimensional array |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
Non-decision time; a positive floating number |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
Decision threshold; a positive floating number (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
Decay rate of the collapsing boundary (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/Spherical.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
Hyper-spherical diffusion models
HyperSphericalDiffusionModel(threshold_dynamic='fixed')
Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold_dynamic
|
str
|
The type of threshold collapse ('fixed', 'linear', 'exponential', 'hyperbolic', or 'custom'), default is 'fixed' |
'fixed'
|
Source code in src/jeam/Models/HyperSpherical.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 3))
|
The choice angles in spherical coordinates (theta1, theta2, theta3) |
required |
drift_vec
|
(array - like, shape(4) or (n_samples, 4))
|
The drift rates in each dimension |
required |
ndt
|
(float or array - like, shape(n_samples))
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(4) or (n_samples, 4))
|
The drift rates in each dimension |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
ProjectedHyperSphericalDiffusionModel(threshold_dynamic='fixed')
Projected Hyper-Spherical Diffusion Model
Source code in src/jeam/Models/HyperSpherical.py
298 299 300 301 302 303 304 | |
joint_lpdf(rt, theta, drift_vec, ndt, threshold, decay=0, threshold_function=None, dt_threshold_function=None, s_v=0, s_t=0, sigma=1, approximation_step=0.01)
Compute the joint log-probability density function of response time and choice angles for the Projected Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
(array - like, shape(n_samples))
|
The response times |
required |
theta
|
(array - like, shape(n_samples, 2))
|
The choice angles in spherical coordinates (theta1, theta2) |
required |
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift rates in each dimension |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float
|
The decision threshold (default is 1) |
required |
decay
|
float
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
dt_threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the derivative of the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
approximation_step
|
float
|
The time step for numerical estimation of first-passage time densities (default is 0.01) |
0.01
|
Returns:
| Name | Type | Description |
|---|---|---|
log_density |
(array - like, shape(n_samples))
|
The joint log-probability density of response time and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
simulate(drift_vec, ndt, threshold=1, decay=0, threshold_function=None, s_v=0, s_t=0, sigma=1, dt=0.001, n_sample=1)
Simulate data from the Projected Hyper-Spherical Diffusion Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drift_vec
|
(array - like, shape(3) or (n_samples, 3))
|
The drift vector [drift_x, drift_y, drift_z]. Note that drift_z must be non-negative, as it represents the projection onto the upper hemisphere. |
required |
ndt
|
float or array-like with the shape of (n_samples,)
|
The non-decision time |
required |
threshold
|
float or array-like with the shape of (n_samples,)
|
The decision threshold (default is 1) |
1
|
decay
|
float or array-like with the shape of (n_samples,)
|
The threshold decay rate (default is 0) |
0
|
threshold_function
|
callable, if threshold_dynamic is 'custom'
|
A function that takes time t and returns the threshold at time t |
None
|
s_v
|
float
|
The standard deviation of drift variability (default is 0) |
0
|
s_t
|
float
|
The standard deviation of non-decision time variability (default is 0) |
0
|
sigma
|
float
|
The diffusion coefficient (default is 1) |
1
|
dt
|
float
|
Time step for the simulation (default is 0.001) |
0.001
|
n_sample
|
int
|
Number of samples to simulate (default is 1) |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing simulated response times and choice angles |
Source code in src/jeam/Models/HyperSpherical.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |