Public API¶
For mathematical definitions of the main estimands, transformations, studentization rules, and calibration statistics, see the function → equation index and implementation-matched mathematical reference. For decision flow, use the workflow atlas; for representative rendered outputs, see the visual gallery.
Multivariate surrogate testing¶
eyetrajectoriespy.MultivariateIAAFTResult
dataclass
¶
Cross-spectrum-aware multivariate IAAFT surrogate ensemble.
Source code in src/eyetrajectoriespy/nonlinear_types.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
eyetrajectoriespy.MultivariateSurrogateNonlinearityResult
dataclass
¶
Monte Carlo nonlinear-statistic test using multivariate IAAFT surrogates.
Source code in src/eyetrajectoriespy/nonlinear_types.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
eyetrajectoriespy.generate_multivariate_iaaft_surrogates ¶
generate_multivariate_iaaft_surrogates(trajectories: TrajectorySet, *, curve: int | str, dimensions: Sequence[str], reference_dimension: str, n_surrogates: int = 199, max_iterations: int = 1000, tolerance: float = 1e-08, random_state: int | None = None) -> MultivariateIAAFTResult
Generate cross-spectrum-aware multivariate IAAFT surrogates.
The implementation follows the Prichard-Theiler multivariate phase constraint extended through an IAAFT rank-remapping loop. At each Fourier adjustment, the original inter-channel phase differences are imposed relative to an explicitly declared reference dimension while every channel receives its original Fourier amplitudes. Rank remapping then restores each channel's empirical marginal distribution exactly.
Because rank remapping perturbs the spectrum, the final power spectra and cross-spectra are approximate and their relative errors are retained for every surrogate. The reference dimension is never selected automatically.
Source code in src/eyetrajectoriespy/multivariate_surrogates.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.multivariate_iaaft_diagnostics_frame ¶
multivariate_iaaft_diagnostics_frame(result: MultivariateIAAFTResult) -> pd.DataFrame
Return convergence and spectral diagnostics for every surrogate.
Source code in src/eyetrajectoriespy/multivariate_surrogates.py
365 366 367 368 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 | |
eyetrajectoriespy.multivariate_surrogate_nonlinearity_test ¶
multivariate_surrogate_nonlinearity_test(trajectories: TrajectorySet, *, curve: int | str, dimensions: Sequence[str], reference_dimension: str, statistic: str, embedding_dimension: int, delay: float | int, theiler_window: float | int, max_horizon: float | int, fit_start: float | int, fit_end: float | int, delay_units: str = 'samples', theiler_window_units: str = 'samples', max_horizon_units: str = 'samples', fit_units: str = 'samples', n_surrogates: int = 199, alternative: str = 'greater', max_iterations: int = 1000, tolerance: float = 1e-08, random_state: int | None = None) -> MultivariateSurrogateNonlinearityResult
Test multichannel LLE against cross-spectrum-aware MIAAFT surrogates.
Source code in src/eyetrajectoriespy/multivariate_surrogates.py
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 | |
eyetrajectoriespy.plot_multivariate_iaaft_diagnostics ¶
plot_multivariate_iaaft_diagnostics(result: MultivariateIAAFTResult, *, ax=None)
Plot per-surrogate power- and cross-spectrum preservation errors.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_multivariate_surrogate_nonlinearity ¶
plot_multivariate_surrogate_nonlinearity(result: MultivariateSurrogateNonlinearityResult, *, bins: int = 20, ax=None)
Plot a multivariate-surrogate statistic distribution.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |
eyetrajectoriespy.multivariate_iaaft_reporting_text ¶
multivariate_iaaft_reporting_text(result: MultivariateIAAFTResult) -> str
Return manuscript-ready wording for multivariate IAAFT generation.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
eyetrajectoriespy.multivariate_surrogate_nonlinearity_reporting_text ¶
multivariate_surrogate_nonlinearity_reporting_text(result: MultivariateSurrogateNonlinearityResult) -> str
Return manuscript-ready wording for multivariate surrogate testing.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
Recurrence networks¶
eyetrajectoriespy.RecurrenceNetworkResult
dataclass
¶
Sparse recurrence-network topology with explicit graph conventions.
Source code in src/eyetrajectoriespy/nonlinear_types.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
eyetrajectoriespy.recurrence_network ¶
recurrence_network(recurrence: RecurrenceResult) -> RecurrenceNetworkResult
Convert one auto-recurrence matrix into an undirected simple network.
Every recurrence state/time index becomes one network node. Every retained off-diagonal recurrence pair becomes one undirected edge.
The network inherits the recurrence threshold, state representation, metric, Theiler exclusion, and any target-recurrence-rate constraint from the source recurrence object. No edge weighting, temporal edge restoration, graph threshold tuning, community optimization, or dimensionality interpretation is introduced automatically.
Source code in src/eyetrajectoriespy/recurrence_networks.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 | |
eyetrajectoriespy.recurrence_network_node_frame ¶
recurrence_network_node_frame(result: RecurrenceNetworkResult) -> pd.DataFrame
Return one row per recurrence-network node/state index.
Source code in src/eyetrajectoriespy/recurrence_networks.py
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 | |
eyetrajectoriespy.recurrence_network_summary_frame ¶
recurrence_network_summary_frame(result: RecurrenceNetworkResult) -> pd.DataFrame
Return a one-row table of global recurrence-network summaries.
Source code in src/eyetrajectoriespy/recurrence_networks.py
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 | |
eyetrajectoriespy.plot_recurrence_network_degree ¶
plot_recurrence_network_degree(result: RecurrenceNetworkResult, *, normalized: bool = True, ax=None)
Plot recurrence-network degree across source state indices.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.recurrence_network_reporting_text ¶
recurrence_network_reporting_text(result: RecurrenceNetworkResult) -> str
Return manuscript-ready wording for recurrence-network topology.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 122 123 124 | |
Joint recurrence analysis¶
eyetrajectoriespy.JointRecurrenceResult
dataclass
¶
Sparse intersection of synchronized auto-recurrence matrices.
Source code in src/eyetrajectoriespy/nonlinear_types.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
eyetrajectoriespy.joint_recurrence_matrix ¶
joint_recurrence_matrix(recurrences: Sequence[RecurrenceResult], *, labels: Sequence[str] | None = None) -> JointRecurrenceResult
Intersect synchronized auto-recurrence matrices.
A joint recurrence is present at (i, j) only when every supplied subsystem is recurrent at the same pair of time indices. Each subsystem may use its own state dimension, distance metric, and radius policy.
Version 0.39 requires all component recurrence matrices to be auto recurrence results on the exact same time grid with the same Theiler exclusion. No resampling, lag shifting, synchronization, threshold harmonization, or target-rate re-estimation is performed.
Source code in src/eyetrajectoriespy/joint_recurrence.py
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 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 | |
eyetrajectoriespy.joint_recurrence_component_frame ¶
joint_recurrence_component_frame(result: JointRecurrenceResult) -> pd.DataFrame
Return one row per component recurrence contract.
Source code in src/eyetrajectoriespy/joint_recurrence.py
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 | |
eyetrajectoriespy.joint_rqa_metrics ¶
joint_rqa_metrics(result: JointRecurrenceResult, *, min_diagonal_length: int = 2, min_vertical_length: int = 2) -> RQAResult
Compute standard line-based RQA metrics on a joint recurrence plot.
Source code in src/eyetrajectoriespy/joint_recurrence.py
296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.plot_joint_recurrence ¶
plot_joint_recurrence(result: JointRecurrenceResult, *, max_points: int | None = 200000, ax=None)
Plot a sparse joint recurrence matrix without densifying it.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 122 123 | |
eyetrajectoriespy.joint_recurrence_reporting_text ¶
joint_recurrence_reporting_text(result: JointRecurrenceResult, metrics: RQAResult | None = None) -> str
Return manuscript-ready wording for synchronized joint recurrence.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
Nonlinear trajectory dynamics¶
Delay reconstruction and embedding diagnostics¶
eyetrajectoriespy.DelayEmbeddingResult
dataclass
¶
Delay-coordinate state-space reconstruction for common-grid trajectories.
Source code in src/eyetrajectoriespy/nonlinear_types.py
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 | |
eyetrajectoriespy.EmbeddingDelayDiagnosticResult
dataclass
¶
Average-mutual-information and autocorrelation delay diagnostics.
Source code in src/eyetrajectoriespy/nonlinear_types.py
45 46 47 48 49 50 51 52 53 54 55 | |
eyetrajectoriespy.EmbeddingDimensionDiagnosticResult
dataclass
¶
False-nearest-neighbor embedding-dimension diagnostics.
Source code in src/eyetrajectoriespy/nonlinear_types.py
58 59 60 61 62 63 64 65 66 67 68 69 | |
eyetrajectoriespy.delay_embed_trajectory ¶
delay_embed_trajectory(trajectories: TrajectorySet, *, embedding_dimension: int, delay: float | int, delay_units: str = 'samples', dimensions: Sequence[str] | None = None) -> DelayEmbeddingResult
Reconstruct a multivariate delay-coordinate state space.
No smoothing, interpolation, scaling, or parameter selection is performed. Time-based delays require a regular common grid and must map to an integer number of observed samples.
Source code in src/eyetrajectoriespy/embedding.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 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 | |
eyetrajectoriespy.embedding_delay_diagnostics ¶
embedding_delay_diagnostics(trajectories: TrajectorySet, *, curve: int | str, dimension: str, max_lag: float | int, max_lag_units: str = 'samples', bins: int = 16) -> EmbeddingDelayDiagnosticResult
Compute autocorrelation and average-mutual-information delay diagnostics.
The function marks the first interior AMI local minimum when one exists but does not select or return an analysis delay automatically.
Source code in src/eyetrajectoriespy/embedding.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
eyetrajectoriespy.embedding_dimension_diagnostics ¶
embedding_dimension_diagnostics(trajectories: TrajectorySet, *, curve: int | str, dimension: str, delay: float | int, delay_units: str = 'samples', max_dimension: int = 10, theiler_window: float | int = 0, theiler_window_units: str = 'samples', rtol: float = 10.0, atol: float = 2.0) -> EmbeddingDimensionDiagnosticResult
Compute Kennel-style false-nearest-neighbor fractions across dimensions.
The diagnostic curve is returned without silently choosing an embedding dimension.
Source code in src/eyetrajectoriespy/embedding.py
360 361 362 363 364 365 366 367 368 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 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
eyetrajectoriespy.plot_embedding_delay_diagnostics ¶
plot_embedding_delay_diagnostics(result: EmbeddingDelayDiagnosticResult, *, ax=None)
Plot AMI and autocorrelation against lag without selecting a delay.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_embedding_dimension_diagnostics ¶
plot_embedding_dimension_diagnostics(result: EmbeddingDimensionDiagnosticResult, *, ax=None)
Plot false-nearest-neighbor fraction against embedding dimension.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
Sparse recurrence and RQA¶
eyetrajectoriespy.RecurrenceResult
dataclass
¶
Sparse recurrence or cross-recurrence matrix plus explicit construction metadata.
Source code in src/eyetrajectoriespy/nonlinear_types.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
eyetrajectoriespy.RecurrenceRadiusProfileResult
dataclass
¶
Exact recurrence-rate profile over an analyst-declared radius grid.
Source code in src/eyetrajectoriespy/nonlinear_types.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
eyetrajectoriespy.RQAResult
dataclass
¶
Recurrence-quantification metrics with line-threshold provenance.
Source code in src/eyetrajectoriespy/nonlinear_types.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
eyetrajectoriespy.WindowedRQAResult
dataclass
¶
Time-resolved RQA metrics from explicitly sized sliding windows.
Source code in src/eyetrajectoriespy/nonlinear_types.py
181 182 183 184 185 186 187 188 189 190 | |
eyetrajectoriespy.WindowedRQAFunctionalResult
dataclass
¶
Functional trajectory representation of windowed RQA across curves.
Source code in src/eyetrajectoriespy/nonlinear_types.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
eyetrajectoriespy.WindowedRQASensitivityResult
dataclass
¶
Declared window/step sensitivity analyses for functional RQA.
Source code in src/eyetrajectoriespy/nonlinear_types.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
eyetrajectoriespy.WindowedRQAMeanBandResult
dataclass
¶
Unit-level simultaneous mean band for functional RQA trajectories.
Source code in src/eyetrajectoriespy/nonlinear_types.py
234 235 236 237 238 239 240 241 242 | |
eyetrajectoriespy.recurrence_matrix ¶
recurrence_matrix(source: TrajectorySet | DelayEmbeddingResult, *, curve: int | str, radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None) -> RecurrenceResult
Construct a sparse symmetric recurrence matrix for one trajectory.
Exactly one radius policy must be declared. The main diagonal and all pairs within the explicit Theiler window are excluded.
Source code in src/eyetrajectoriespy/recurrence.py
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 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 | |
eyetrajectoriespy.recurrence_radius_profile ¶
recurrence_radius_profile(source: TrajectorySet | DelayEmbeddingResult, *, curve: int | str, radii: Sequence[float], metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None) -> RecurrenceRadiusProfileResult
Compute exact recurrence density over a declared increasing radius grid.
The table is the empirical cumulative distribution of eligible pairwise state-space distances evaluated at the supplied radii. It is computed without materializing an N x N distance matrix.
Theiler-excluded temporal neighbors are removed from both the pair counts
and recurrence-rate denominator using the same contract as
:func:recurrence_matrix. No radius is selected automatically.
Source code in src/eyetrajectoriespy/recurrence.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.rqa_metrics ¶
rqa_metrics(recurrence: RecurrenceResult, *, min_diagonal_length: int = 2, min_vertical_length: int = 2) -> RQAResult
Compute standard line-based recurrence-quantification metrics.
Source code in src/eyetrajectoriespy/recurrence.py
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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
eyetrajectoriespy.windowed_rqa ¶
windowed_rqa(trajectories: TrajectorySet, *, curve: int | str, window: float | int, step: float | int, window_units: str = 'samples', step_units: str = 'samples', radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None, min_diagonal_length: int = 2, min_vertical_length: int = 2) -> WindowedRQAResult
Compute RQA in full sliding windows while reporting any trailing tail.
Source code in src/eyetrajectoriespy/recurrence.py
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | |
eyetrajectoriespy.windowed_rqa_trajectory_set ¶
windowed_rqa_trajectory_set(trajectories: TrajectorySet, *, metrics: Sequence[str], window: float | int, step: float | int, window_units: str = 'samples', step_units: str = 'samples', radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None, min_diagonal_length: int = 2, min_vertical_length: int = 2, undefined_policy: str = 'raise') -> WindowedRQAFunctionalResult
Convert per-curve sliding-window RQA into functional trajectories.
Every input curve is analyzed with the same declared recurrence contract. Window-center times become the common functional grid and selected RQA metrics become functional dimensions. The complete per-curve WindowedRQAResult objects are retained so solved radii and window-level diagnostics are never discarded.
undefined_policy='raise' rejects any undefined selected metric. undefined_policy='keep' retains undefined values as NaN. No imputation is performed.
Overlapping windows deterministically reuse source samples. The result records this overlap and never describes window rows as independent observations. If target_recurrence_rate is used, recurrence_rate cannot be selected as a functional outcome because its density is controlled by construction.
Source code in src/eyetrajectoriespy/recurrence.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | |
eyetrajectoriespy.windowed_rqa_sensitivity ¶
windowed_rqa_sensitivity(trajectories: TrajectorySet, *, metrics: Sequence[str], window_step_pairs: Sequence[tuple[float | int, float | int]], window_units: str = 'samples', step_units: str = 'samples', radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None, min_diagonal_length: int = 2, min_vertical_length: int = 2, undefined_policy: str = 'raise') -> WindowedRQASensitivityResult
Evaluate declared window/step specifications without selecting one.
Every specification is run through windowed_rqa_trajectory_set under the same recurrence contract. No interpolation is used to compare profiles from different specifications. Pairwise shape diagnostics use exact shared window-center times only.
The design table quantifies deterministic sample reuse caused by overlap. Its profile-grid spacing is the temporal spacing of the derived RQA function, not an estimate of independent-information resolution.
Source code in src/eyetrajectoriespy/functional_rqa.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.windowed_rqa_functional_mean_band ¶
windowed_rqa_functional_mean_band(trajectories: TrajectorySet, *, metrics: Sequence[str], window: float | int, step: float | int, unit: str, participant_column: str | None = None, window_units: str = 'samples', step_units: str = 'samples', radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', dimensions: Sequence[str] | None = None, min_diagonal_length: int = 2, min_vertical_length: int = 2, confidence_level: float = 0.95, n_multiplier: int = 2000, random_state: int | None = 0) -> WindowedRQAMeanBandResult
Estimate a unit-level simultaneous mean band for functional RQA.
Windowed RQA is first computed once per source curve with undefined selected metrics rejected. The existing functional-mean multiplier band is then applied to complete derived functions, never to window rows.
unit="participant" averages repeated trial curves within participant before inference and requires participant_column. unit="curve" treats each source curve as an independent unit and therefore should only be used when that independence is scientifically justified.
Source code in src/eyetrajectoriespy/functional_rqa.py
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 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 | |
eyetrajectoriespy.cross_recurrence_matrix ¶
cross_recurrence_matrix(source_a: TrajectorySet | DelayEmbeddingResult, source_b: TrajectorySet | DelayEmbeddingResult, *, curve_a: int | str, curve_b: int | str, radius: float | None = None, target_recurrence_rate: float | None = None, metric: str = 'euclidean', dimensions_a: Sequence[str] | None = None, dimensions_b: Sequence[str] | None = None) -> RecurrenceResult
Construct a sparse cross-recurrence matrix between two trajectories.
Source code in src/eyetrajectoriespy/recurrence.py
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 | |
eyetrajectoriespy.cross_rqa_metrics ¶
cross_rqa_metrics(recurrence: RecurrenceResult, *, min_diagonal_length: int = 2, min_vertical_length: int = 2) -> RQAResult
Compute line-based metrics for a cross-recurrence result.
Source code in src/eyetrajectoriespy/recurrence.py
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
eyetrajectoriespy.plot_recurrence ¶
plot_recurrence(result: RecurrenceResult, *, max_points: int | None = 200000, ax=None)
Plot the sparse recurrence matrix without densifying it.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_recurrence_rate_curve ¶
plot_recurrence_rate_curve(result: RecurrenceRadiusProfileResult, *, ax=None)
Plot exact recurrence rate against the declared radius grid.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
eyetrajectoriespy.plot_windowed_rqa ¶
plot_windowed_rqa(result: WindowedRQAResult, *, metrics: Sequence[str] = ('recurrence_rate', 'determinism', 'laminarity'), ax=None)
Plot selected time-varying RQA metrics.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
eyetrajectoriespy.plot_windowed_rqa_trajectories ¶
plot_windowed_rqa_trajectories(result: WindowedRQAFunctionalResult, *, metric: str, show_mean: bool = False, max_curves: int | None = None, ax=None)
Plot one functional windowed-RQA metric across source curves.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_windowed_rqa_sensitivity ¶
plot_windowed_rqa_sensitivity(result: WindowedRQASensitivityResult, *, curve: int | str, metric: str, ax=None)
Overlay one curve/metric across declared window/step specifications.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
Population uncertainty for RQA summaries¶
eyetrajectoriespy.RQAMeanBootstrapResult
dataclass
¶
Bootstrap uncertainty for population-average per-curve RQA metrics.
Source code in src/eyetrajectoriespy/nonlinear_types.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
eyetrajectoriespy.bootstrap_rqa_metric_means ¶
bootstrap_rqa_metric_means(trajectories: TrajectorySet, *, dimensions: Sequence[str], metrics: Sequence[str], radius: float | None = None, target_recurrence_rate: float | None = None, distance_metric: str = 'euclidean', theiler_window: float | int = 0, theiler_window_units: str = 'samples', min_diagonal_length: int = 2, min_vertical_length: int = 2, embedding_dimension: int | None = None, delay: float | int | None = None, delay_units: str = 'samples', unit: str = 'curve', participant_column: str | None = None, confidence_level: float = 0.95, n_bootstrap: int = 2000, random_state: int | None = 0) -> RQAMeanBootstrapResult
Bootstrap population-average per-curve RQA metrics.
RQA metrics are first computed once for every observed source curve under one fixed, fully declared recurrence contract. Bootstrap resampling then operates on the independent analysis units: curves, or equal-weight participant averages when repeated trials are present.
This is a population-sampling bootstrap for the mean of curve-level RQA summaries. It does not estimate within-single-trajectory recurrence uncertainty, does not resample recurrence lines, and does not implement a moving/block bootstrap for one time series.
Source code in src/eyetrajectoriespy/rqa_inference.py
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 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 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 446 447 448 449 450 451 | |
eyetrajectoriespy.plot_rqa_metric_mean_bootstrap ¶
plot_rqa_metric_mean_bootstrap(result: RQAMeanBootstrapResult, *, metrics: Sequence[str] | None = None, ax=None)
Plot population-average RQA metrics with percentile-bootstrap intervals.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
Declared nonlinear parameter sensitivity¶
eyetrajectoriespy.RQAParameterSensitivityResult
dataclass
¶
Declared multiverse of reconstructed-state RQA specifications.
Source code in src/eyetrajectoriespy/nonlinear_types.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
eyetrajectoriespy.LyapunovParameterSensitivityResult
dataclass
¶
Declared multiverse of Rosenstein LLE specifications.
Source code in src/eyetrajectoriespy/nonlinear_types.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
eyetrajectoriespy.KantzParameterSensitivityResult
dataclass
¶
Declared multiverse of Kantz LLE neighborhood specifications.
Source code in src/eyetrajectoriespy/nonlinear_types.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
eyetrajectoriespy.rqa_parameter_sensitivity ¶
rqa_parameter_sensitivity(trajectories: TrajectorySet, *, curve: int | str, dimensions: Sequence[str], embedding_dimensions: Sequence[int], delays: Sequence[float | int], theiler_windows: Sequence[float | int], min_diagonal_lengths: Sequence[int], min_vertical_lengths: Sequence[int], radii: Sequence[float] | None = None, target_recurrence_rates: Sequence[float] | None = None, delay_units: str = 'samples', theiler_window_units: str = 'samples', distance_metric: str = 'euclidean') -> RQAParameterSensitivityResult
Evaluate a predeclared RQA parameter multiverse without selecting a winner.
Exactly one recurrence-threshold grid must be supplied: radii or target_recurrence_rates. Every Cartesian-product specification is evaluated. Invalid specifications fail the whole analysis with the offending combination identified; no failed row is silently discarded.
The returned summaries are descriptive variation across the declared analysis choices. They are not sampling distributions, posterior probabilities, or automatic tuning criteria.
Source code in src/eyetrajectoriespy/nonlinear_sensitivity.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 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 | |
eyetrajectoriespy.lyapunov_parameter_sensitivity ¶
lyapunov_parameter_sensitivity(trajectories: TrajectorySet, *, curve: int | str, dimensions: Sequence[str], embedding_dimensions: Sequence[int], delays: Sequence[float | int], theiler_windows: Sequence[float | int], fit_intervals: Sequence[tuple[float | int, float | int]], max_horizon: float | int, delay_units: str = 'samples', theiler_window_units: str = 'samples', fit_units: str = 'samples', max_horizon_units: str = 'samples') -> LyapunovParameterSensitivityResult
Evaluate declared Rosenstein-LLE reconstruction and fit choices.
Divergence curves are reused across fit intervals for the same embedding and Theiler specification. No fit interval, embedding dimension, delay, or Theiler window is selected automatically.
The fraction of declared specifications with positive exponents is a descriptive property of the analyst-specified grid. It is not a probability that the system is chaotic.
Source code in src/eyetrajectoriespy/nonlinear_sensitivity.py
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 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | |
eyetrajectoriespy.kantz_parameter_sensitivity ¶
kantz_parameter_sensitivity(trajectories: TrajectorySet, *, curve: int | str, dimensions: Sequence[str], embedding_dimensions: Sequence[int], delays: Sequence[float | int], radii: Sequence[float], min_neighbors: Sequence[int], theiler_windows: Sequence[float | int], fit_intervals: Sequence[tuple[float | int, float | int]], max_horizon: float | int, delay_units: str = 'samples', theiler_window_units: str = 'samples', fit_units: str = 'samples', max_horizon_units: str = 'samples') -> KantzParameterSensitivityResult
Evaluate a declared Kantz-LLE parameter multiverse without tuning.
Every Cartesian-product specification is evaluated. Divergence curves are reused across fit intervals for the same resolved embedding, radius, minimum-neighbor, and Theiler contract. Invalid specifications fail the complete analysis rather than being silently removed.
The resulting ranges and sign fractions describe sensitivity across the analyst-declared grid. They are not confidence intervals, posterior probabilities, or probabilities that the source dynamics are chaotic.
Source code in src/eyetrajectoriespy/nonlinear_sensitivity.py
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
eyetrajectoriespy.plot_rqa_sensitivity ¶
plot_rqa_sensitivity(result: RQAParameterSensitivityResult, *, parameter: str, metric: str, filters: Mapping[str, object] | None = None, ax=None)
Plot one explicit one-parameter slice of an RQA sensitivity grid.
Source code in src/eyetrajectoriespy/nonlinear_plotting.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 | |
eyetrajectoriespy.plot_lyapunov_sensitivity ¶
plot_lyapunov_sensitivity(result: LyapunovParameterSensitivityResult, *, parameter: str, response: str = 'exponent', filters: Mapping[str, object] | None = None, ax=None)
Plot one explicit one-parameter slice of an LLE sensitivity grid.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_kantz_sensitivity ¶
plot_kantz_sensitivity(result: KantzParameterSensitivityResult, *, parameter: str, response: str = 'exponent', filters: Mapping[str, object] | None = None, ax=None)
Plot one explicit one-parameter slice of a Kantz sensitivity grid.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
Local divergence and surrogate testing¶
eyetrajectoriespy.LocalDivergenceResult
dataclass
¶
Rosenstein-style mean log-divergence curve before linear fitting.
Source code in src/eyetrajectoriespy/nonlinear_types.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
eyetrajectoriespy.KantzDivergenceResult
dataclass
¶
Kantz neighborhood-averaged mean log-divergence curve.
Source code in src/eyetrajectoriespy/nonlinear_types.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
eyetrajectoriespy.LargestLyapunovResult
dataclass
¶
Largest-Lyapunov estimate from an explicitly selected divergence interval.
Source code in src/eyetrajectoriespy/nonlinear_types.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
eyetrajectoriespy.SurrogateNonlinearityResult
dataclass
¶
Monte Carlo surrogate-data test for a declared nonlinear statistic.
Source code in src/eyetrajectoriespy/nonlinear_types.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
eyetrajectoriespy.local_divergence_curve ¶
local_divergence_curve(embedding: DelayEmbeddingResult, *, curve: int | str, theiler_window: float | int, max_horizon: float | int, theiler_window_units: str = 'samples', max_horizon_units: str = 'samples') -> LocalDivergenceResult
Compute a Rosenstein-style mean log-divergence curve.
Zero distances encountered after forward evolution are excluded from the logarithm but counted explicitly in zero_distance_counts.
Source code in src/eyetrajectoriespy/nonlinear_dynamics.py
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
eyetrajectoriespy.kantz_divergence_curve ¶
kantz_divergence_curve(embedding: DelayEmbeddingResult, *, curve: int | str, radius: float, theiler_window: float | int, max_horizon: float | int, min_neighbors: int = 2, theiler_window_units: str = 'samples', max_horizon_units: str = 'samples') -> KantzDivergenceResult
Compute a Kantz-style neighborhood-averaged log-divergence curve.
The neighborhood radius is fixed and analyst-declared. Reference states with fewer than the declared minimum neighbors are not enlarged or repaired automatically.
Source code in src/eyetrajectoriespy/nonlinear_dynamics.py
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 | |
eyetrajectoriespy.estimate_largest_lyapunov_rosenstein ¶
estimate_largest_lyapunov_rosenstein(divergence: LocalDivergenceResult, *, fit_start: float | int, fit_end: float | int, fit_units: str = 'samples') -> LargestLyapunovResult
Fit the declared linear segment of a Rosenstein divergence curve.
A positive result is a local-divergence estimate and is not, by itself, evidence that behavioral gaze is a deterministic chaotic system.
Source code in src/eyetrajectoriespy/nonlinear_dynamics.py
304 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 | |
eyetrajectoriespy.estimate_largest_lyapunov_kantz ¶
estimate_largest_lyapunov_kantz(divergence: KantzDivergenceResult, *, fit_start: float | int, fit_end: float | int, fit_units: str = 'samples') -> LargestLyapunovResult
Fit the declared linear segment of a Kantz divergence curve.
Source code in src/eyetrajectoriespy/nonlinear_dynamics.py
366 367 368 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 | |
eyetrajectoriespy.surrogate_nonlinearity_test ¶
surrogate_nonlinearity_test(trajectories: TrajectorySet, *, curve: int | str, dimension: str, statistic: str, embedding_dimension: int, delay: float | int, theiler_window: float | int, max_horizon: float | int, fit_start: float | int, fit_end: float | int, delay_units: str = 'samples', theiler_window_units: str = 'samples', max_horizon_units: str = 'samples', fit_units: str = 'samples', method: str = 'iaaft', n_surrogates: int = 199, alternative: str = 'greater', max_iterations: int = 1000, tolerance: float = 1e-08, random_state: int | None = None) -> SurrogateNonlinearityResult
Test a declared nonlinear statistic against IAAFT surrogate series.
Version 0.23 supports statistic='largest_lyapunov' only. Every surrogate is evaluated under the identical embedding and fit contract.
Source code in src/eyetrajectoriespy/nonlinear_dynamics.py
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 590 591 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 656 657 658 659 660 | |
eyetrajectoriespy.plot_local_divergence ¶
plot_local_divergence(result: LocalDivergenceResult | KantzDivergenceResult | LargestLyapunovResult, *, ax=None)
Plot the mean log-divergence curve and an explicit LLE fit when present.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 | |
eyetrajectoriespy.plot_surrogate_nonlinearity ¶
plot_surrogate_nonlinearity(result: SurrogateNonlinearityResult, *, bins: int = 20, ax=None)
Plot the surrogate statistic distribution and observed statistic.
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
Nonlinear reporting helpers¶
eyetrajectoriespy.recurrence_radius_profile_reporting_text ¶
recurrence_radius_profile_reporting_text(result: RecurrenceRadiusProfileResult) -> str
Return manuscript-ready wording for recurrence-threshold diagnostics.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
eyetrajectoriespy.rqa_metric_mean_bootstrap_reporting_text ¶
rqa_metric_mean_bootstrap_reporting_text(result: RQAMeanBootstrapResult) -> str
Return manuscript-ready wording for population-average RQA uncertainty.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
eyetrajectoriespy.rqa_reporting_text ¶
rqa_reporting_text(recurrence: RecurrenceResult, metrics: RQAResult) -> str
Return concise manuscript-ready recurrence-analysis wording.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
eyetrajectoriespy.rqa_parameter_sensitivity_reporting_text ¶
rqa_parameter_sensitivity_reporting_text(result: RQAParameterSensitivityResult) -> str
Return manuscript-ready wording for an RQA parameter multiverse.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
eyetrajectoriespy.windowed_rqa_reporting_text ¶
windowed_rqa_reporting_text(result: WindowedRQAResult) -> str
Return concise manuscript-ready wording for sliding-window RQA.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
221 222 223 224 225 226 227 228 229 230 | |
eyetrajectoriespy.windowed_rqa_functional_reporting_text ¶
windowed_rqa_functional_reporting_text(result: WindowedRQAFunctionalResult) -> str
Return manuscript-ready wording for RQA-derived functional trajectories.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
eyetrajectoriespy.windowed_rqa_sensitivity_reporting_text ¶
windowed_rqa_sensitivity_reporting_text(result: WindowedRQASensitivityResult) -> str
Return manuscript-ready wording for declared window/step sensitivity.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
eyetrajectoriespy.windowed_rqa_mean_band_reporting_text ¶
windowed_rqa_mean_band_reporting_text(result: WindowedRQAMeanBandResult) -> str
Return wording for unit-level simultaneous functional-RQA inference.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
eyetrajectoriespy.kantz_parameter_sensitivity_reporting_text ¶
kantz_parameter_sensitivity_reporting_text(result: KantzParameterSensitivityResult) -> str
Return manuscript-ready wording for declared Kantz-LLE sensitivity.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
eyetrajectoriespy.largest_lyapunov_reporting_text ¶
largest_lyapunov_reporting_text(result: LargestLyapunovResult) -> str
Return named-estimator LLE wording without turning slope into a chaos claim.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
eyetrajectoriespy.lyapunov_parameter_sensitivity_reporting_text ¶
lyapunov_parameter_sensitivity_reporting_text(result: LyapunovParameterSensitivityResult) -> str
Return manuscript-ready wording for Rosenstein-LLE sensitivity.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
eyetrajectoriespy.surrogate_nonlinearity_reporting_text ¶
surrogate_nonlinearity_reporting_text(result: SurrogateNonlinearityResult) -> str
Return manuscript-ready IAAFT surrogate-test wording.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
eyetrajectoriespy.return_map_stability_reporting_text ¶
return_map_stability_reporting_text(fit: LocalReturnMapResult, result: ReturnMapStabilityResult) -> str
Return manuscript-ready wording for experimental empirical return-map stability.
Source code in src/eyetrajectoriespy/nonlinear_reporting.py
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 | |
Experimental empirical return maps¶
eyetrajectoriespy.PoincareCrossingResult
dataclass
¶
Interpolated crossings of an explicitly declared Poincare section.
Source code in src/eyetrajectoriespy/nonlinear_types.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
eyetrajectoriespy.LocalReturnMapResult
dataclass
¶
Local affine return-map fit around an explicitly declared reference state.
Source code in src/eyetrajectoriespy/nonlinear_types.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
eyetrajectoriespy.ReturnMapStabilityResult
dataclass
¶
Eigenvalue-based local return-map contraction/expansion diagnostic.
Source code in src/eyetrajectoriespy/nonlinear_types.py
469 470 471 472 473 474 475 476 477 | |
eyetrajectoriespy.poincare_crossings ¶
poincare_crossings(trajectories: TrajectorySet, *, curve: int | str, section_dimension: str, section_value: float, direction: str, state_dimensions: Sequence[str] | None = None) -> PoincareCrossingResult
Interpolate crossings of an explicitly declared scalar section.
By default, the returned crossing state contains every trajectory dimension except the section dimension, avoiding an automatically constant coordinate in downstream return-map regression.
Source code in src/eyetrajectoriespy/return_maps.py
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 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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
eyetrajectoriespy.fit_local_return_map ¶
fit_local_return_map(crossings: PoincareCrossingResult, *, reference: str | ndarray, neighborhood_radius: float | None = None, n_neighbors: int | None = None) -> LocalReturnMapResult
Fit a local affine map from one section crossing to the next.
Exactly one neighborhood policy must be specified. The fitted Jacobian is empirical and must not be described as a classical monodromy matrix.
Source code in src/eyetrajectoriespy/return_maps.py
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 | |
eyetrajectoriespy.return_map_stability ¶
return_map_stability(fit: LocalReturnMapResult, *, tolerance: float = 1e-06) -> ReturnMapStabilityResult
Summarize empirical return-map contraction or expansion from eigenvalues.
Source code in src/eyetrajectoriespy/return_maps.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 | |
eyetrajectoriespy.plot_poincare_return_map ¶
plot_poincare_return_map(crossings: PoincareCrossingResult, *, fit: LocalReturnMapResult | None = None, ax=None)
Plot a one-dimensional empirical return map x_n -> x_(n+1).
Source code in src/eyetrajectoriespy/nonlinear_plotting.py
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 656 657 658 659 660 661 662 663 664 | |
Mathematical contracts¶
eyetrajectoriespy.MathematicalContract
dataclass
¶
Mathematical specification attached to one or more public APIs.
Source code in src/eyetrajectoriespy/mathematical_contracts.py
15 16 17 18 19 20 21 22 23 24 | |
eyetrajectoriespy.list_mathematical_contracts ¶
list_mathematical_contracts() -> tuple[MathematicalContract, ...]
Return all mathematical contracts in stable documentation order.
Source code in src/eyetrajectoriespy/mathematical_contracts.py
874 875 876 877 | |
eyetrajectoriespy.get_mathematical_contract ¶
get_mathematical_contract(name: str) -> MathematicalContract
Return a mathematical contract by key or registered public function.
Source code in src/eyetrajectoriespy/mathematical_contracts.py
880 881 882 883 884 885 886 887 888 | |
eyetrajectoriespy.mathematical_contract_frame ¶
mathematical_contract_frame() -> pd.DataFrame
Return one tidy row per registered public function and its LaTeX contract.
Source code in src/eyetrajectoriespy/mathematical_contracts.py
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | |
Reproducibility and portable results¶
eyetrajectoriespy.PortableScientificResultSnapshot
dataclass
¶
Loaded portable scientific snapshot.
This is intentionally not a reconstruction of the original fitted backend object. The payload contains portable scientific state; nonportable_fields records excluded opaque/backend-native fields explicitly.
Source code in src/eyetrajectoriespy/portable_results.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
eyetrajectoriespy.capture_environment ¶
capture_environment() -> dict[str, Any]
Capture the software/platform environment relevant to reproducibility.
Source code in src/eyetrajectoriespy/portable_results.py
102 103 104 105 106 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 | |
eyetrajectoriespy.export_portable_result ¶
export_portable_result(result: Any, directory: str | Path, *, include_environment: bool = True, overwrite: bool = False) -> Path
Export scientific result state as explicit JSON + NPZ.
The bundle is a portable snapshot, not a pickle. Unsupported backend objects are represented by an explicit nonportable marker and listed in the manifest instead of being silently dropped.
Source code in src/eyetrajectoriespy/portable_results.py
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 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
eyetrajectoriespy.load_portable_result ¶
load_portable_result(directory: str | Path) -> PortableScientificResultSnapshot
Load and integrity-check a portable scientific snapshot.
Source code in src/eyetrajectoriespy/portable_results.py
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 | |
Core objects¶
eyetrajectoriespy.TrajectorySet
dataclass
¶
Collection of functional trajectories observed on a common grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
ndarray
|
One-dimensional, strictly increasing common time grid with shape
|
required |
values
|
ndarray
|
Numeric array with shape |
required |
curve_ids
|
tuple[str, ...]
|
Unique labels, one per trajectory. |
required |
dimension_names
|
tuple[str, ...]
|
Names for the functional dimensions, e.g. |
required |
metadata
|
DataFrame
|
One row per curve. It may contain participant, trial, condition, stimulus, or other design variables. |
DataFrame()
|
coordinate_system
|
str
|
Explicit coordinate semantics such as |
'unknown'
|
time_unit
|
str
|
Explicit time unit such as |
'unknown'
|
provenance
|
Mapping[str, Any]
|
JSON-like dictionary describing source/preprocessing decisions. |
dict()
|
Source code in src/eyetrajectoriespy/types.py
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 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 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 | |
dimension ¶
dimension(name: str) -> np.ndarray
Return one named dimension as (n_curves, n_time).
Source code in src/eyetrajectoriespy/types.py
113 114 115 116 117 118 119 120 | |
subset ¶
subset(indices: Sequence[int]) -> 'TrajectorySet'
Return a curve subset while preserving metadata and provenance.
Source code in src/eyetrajectoriespy/types.py
122 123 124 125 126 127 128 | |
with_values ¶
with_values(values: ndarray, *, time: ndarray | None = None, provenance_update: Mapping[str, Any] | None = None, time_unit: str | None = None, coordinate_system: str | None = None) -> 'TrajectorySet'
Create a transformed copy with appended provenance.
Source code in src/eyetrajectoriespy/types.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
eyetrajectoriespy.DiscreteFrechetResult
dataclass
¶
Discrete Fréchet distance plus one deterministic optimal coupling.
Source code in src/eyetrajectoriespy/types.py
156 157 158 159 160 161 162 163 164 165 166 | |
eyetrajectoriespy.FPCAResult
dataclass
¶
Result from grid-based functional principal component analysis.
Source code in src/eyetrajectoriespy/types.py
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 | |
cumulative_explained_variance ¶
cumulative_explained_variance() -> np.ndarray
Cumulative proportion of functional variance explained.
Source code in src/eyetrajectoriespy/types.py
214 215 216 217 | |
eyetrajectoriespy.RegistrationResult
dataclass
¶
Registered trajectories and explicit phase information.
Source code in src/eyetrajectoriespy/types.py
220 221 222 223 224 225 226 227 228 229 230 | |
eyetrajectoriespy.CompositionalFPCAResult
dataclass
¶
FPCA result for simplex-valued AOI probability functions.
Source code in src/eyetrajectoriespy/types.py
233 234 235 236 237 238 239 240 241 | |
eyetrajectoriespy.MultilevelFPCAResult
dataclass
¶
Participant- and trial-level functional variation decomposition.
Source code in src/eyetrajectoriespy/types.py
244 245 246 247 248 249 250 251 252 253 254 | |
eyetrajectoriespy.FPCAStabilityResult
dataclass
¶
Bootstrap stability diagnostics for matched functional principal components.
Source code in src/eyetrajectoriespy/types.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
eyetrajectoriespy.FPCACrossValidationResult
dataclass
¶
Held-out reconstruction diagnostics across candidate FPC counts.
Source code in src/eyetrajectoriespy/types.py
480 481 482 483 484 485 486 487 488 489 490 491 492 | |
eyetrajectoriespy.FPCAComponentEnvelopeResult
dataclass
¶
Pointwise descriptive bootstrap envelopes for matched FPC functions.
Source code in src/eyetrajectoriespy/types.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | |
eyetrajectoriespy.FPCARegressionCVResult
dataclass
¶
Outcome-tuned FPCA regression cross-validation diagnostics.
Source code in src/eyetrajectoriespy/types.py
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | |
eyetrajectoriespy.FPCANestedRegressionCVResult
dataclass
¶
Nested CV evaluation of outcome-tuned FPCA regression selection.
Source code in src/eyetrajectoriespy/types.py
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | |
eyetrajectoriespy.FPCASubspaceComparisonResult
dataclass
¶
Principal-angle comparison of corresponding FPCA component subspaces.
Source code in src/eyetrajectoriespy/types.py
618 619 620 621 622 623 624 625 626 627 628 629 | |
eyetrajectoriespy.FPCASubspaceStabilityResult
dataclass
¶
Bootstrap stability diagnostics for an FPCA component subspace.
Source code in src/eyetrajectoriespy/types.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
eyetrajectoriespy.SparseFPCAResult
dataclass
¶
Sparse univariate FPCA fitted to native irregular observations.
Source code in src/eyetrajectoriespy/types.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
eyetrajectoriespy.FunctionalMeanBandResult
dataclass
¶
Simultaneous multiplier-bootstrap band for a functional mean.
Source code in src/eyetrajectoriespy/types.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | |
eyetrajectoriespy.FPCAInfluenceResult
dataclass
¶
Leave-one-group-out sensitivity of functional principal components.
Source code in src/eyetrajectoriespy/types.py
468 469 470 471 472 473 474 475 476 477 | |
eyetrajectoriespy.FunctionalOutlierResult
dataclass
¶
Functional outlier/review diagnostics without automatic exclusion.
Source code in src/eyetrajectoriespy/types.py
457 458 459 460 461 462 463 464 465 | |
Native and common-grid import¶
eyetrajectoriespy.from_irregular_long_dataframe_native ¶
from_irregular_long_dataframe_native(data: DataFrame, *, curve_columns: Sequence[str], time_column: str, value_columns: Sequence[str] = ('x', 'y'), metadata_columns: Sequence[str] | None = None, coordinate_system: str = 'unknown', time_unit: str = 'unknown', provenance: dict[str, Any] | None = None) -> IrregularTrajectorySet
Create an irregular trajectory set without resampling.
Duplicate time points are rejected because their interpretation is experiment-specific. Functional values may contain missing observations; those remain missing and are not converted to zeros or interpolated.
Source code in src/eyetrajectoriespy/irregular.py
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 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 | |
eyetrajectoriespy.irregular_sampling_summary ¶
irregular_sampling_summary(trajectories: IrregularTrajectorySet) -> pd.DataFrame
Return per-curve sampling and missingness diagnostics.
Source code in src/eyetrajectoriespy/irregular.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
eyetrajectoriespy.common_overlap_interval ¶
common_overlap_interval(trajectories: IrregularTrajectorySet) -> tuple[float, float]
Return the time interval observed by every curve.
Source code in src/eyetrajectoriespy/irregular.py
100 101 102 103 104 105 106 107 | |
eyetrajectoriespy.make_common_grid ¶
make_common_grid(trajectories: IrregularTrajectorySet, *, n_time: int, domain: str = 'overlap', start: float | None = None, end: float | None = None) -> np.ndarray
Construct an explicit common grid without modifying trajectory values.
The 'overlap' domain uses only time observed by every curve. The 'union' domain spans the full observed range and can create edge missingness after resampling for curves with shorter domains.
Source code in src/eyetrajectoriespy/irregular.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 | |
eyetrajectoriespy.resample_irregular_to_grid ¶
resample_irregular_to_grid(trajectories: IrregularTrajectorySet, grid: ndarray, *, method: str = 'linear', max_gap: float | None = None) -> TrajectorySet
Project native irregular trajectories onto an explicit common grid.
No extrapolation is performed. Long intervals remain missing when max_gap is supplied.
Source code in src/eyetrajectoriespy/irregular.py
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 | |
eyetrajectoriespy.resample_irregular_to_common_grid ¶
resample_irregular_to_common_grid(trajectories: IrregularTrajectorySet, *, n_time: int, domain: str = 'overlap', method: str = 'linear', max_gap: float | None = None) -> TrajectorySet
Create and apply a common grid in one explicit step.
Source code in src/eyetrajectoriespy/irregular.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
Import and validation¶
eyetrajectoriespy.from_long_dataframe ¶
from_long_dataframe(data: DataFrame, *, curve_columns: Sequence[str], time_column: str, value_columns: Sequence[str] = ('x', 'y'), metadata_columns: Sequence[str] | None = None, coordinate_system: str = 'unknown', time_unit: str = 'unknown', require_common_grid: bool = True, provenance: dict[str, Any] | None = None) -> TrajectorySet
Create a :class:TrajectorySet from long-format gaze samples.
The function does not interpolate, smooth, impute, average duplicate time points, or normalize time. Such operations must be requested explicitly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
Long-format dataframe containing one row per gaze sample. |
required |
curve_columns
|
Sequence[str]
|
Columns identifying a trajectory, typically |
required |
time_column
|
str
|
Sample-time column. |
required |
value_columns
|
Sequence[str]
|
Functional channels. For continuous planar gaze this is usually
|
('x', 'y')
|
metadata_columns
|
Sequence[str] | None
|
Curve-constant columns to preserve. If a requested metadata column varies within a curve, an error is raised. |
None
|
require_common_grid
|
bool
|
Retained for backward compatibility. A :class: |
True
|
Source code in src/eyetrajectoriespy/io.py
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 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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
eyetrajectoriespy.from_irregular_long_dataframe ¶
from_irregular_long_dataframe(data: DataFrame, *, curve_columns: Sequence[str], time_column: str, value_columns: Sequence[str] = ('x', 'y'), grid: ndarray, metadata_columns: Sequence[str] | None = None, method: str = 'linear', max_gap: float | None = None, coordinate_system: str = 'unknown', time_unit: str = 'unknown') -> TrajectorySet
Create a common-grid trajectory set from irregular long-format samples.
Resampling is explicit and gap-limited. Values outside each curve's observed domain remain missing rather than being extrapolated.
Source code in src/eyetrajectoriespy/io.py
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 | |
eyetrajectoriespy.validate_trajectory_set ¶
validate_trajectory_set(trajectories: TrajectorySet, *, require_complete: bool = False, require_dimensions: Iterable[str] | None = None) -> TrajectorySet
Validate scientific assumptions that are not enforced by construction.
This function never repairs data. It either returns the input object or raises a descriptive error.
Source code in src/eyetrajectoriespy/validation.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 49 | |
eyetrajectoriespy.validate_simplex ¶
validate_simplex(values: ndarray, *, atol: float = 1e-07) -> None
Validate non-negative functions that sum to one across dimensions.
Source code in src/eyetrajectoriespy/validation.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |
Preprocessing¶
eyetrajectoriespy.resample_to_grid ¶
resample_to_grid(trajectories: TrajectorySet, grid: ndarray, *, method: str = 'linear', max_gap: float | None = None) -> TrajectorySet
Resample common-grid trajectories to a new grid without extrapolation.
Missing observations are interpolated only when bounded by observed values.
If max_gap is supplied, intervals larger than that threshold remain
missing after resampling.
Source code in src/eyetrajectoriespy/preprocessing.py
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 | |
eyetrajectoriespy.interpolate_short_gaps ¶
interpolate_short_gaps(trajectories: TrajectorySet, *, max_gap: float, method: str = 'pchip') -> TrajectorySet
Interpolate only missing runs whose bounding samples are sufficiently close.
This function exists to make interpolation explicit. It never fills leading
or trailing missing values and never bridges a gap longer than max_gap.
Source code in src/eyetrajectoriespy/preprocessing.py
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 | |
eyetrajectoriespy.smooth_trajectories ¶
smooth_trajectories(trajectories: TrajectorySet, *, method: str, window: int | None = None, polyorder: int = 2, sigma: float | None = None) -> TrajectorySet
Smooth functional channels while preserving missing observations.
Smoothing is intentionally opt-in because genuine saccadic transitions are abrupt. The function emits a methodological warning whenever called.
Source code in src/eyetrajectoriespy/preprocessing.py
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 | |
eyetrajectoriespy.normalize_time ¶
normalize_time(trajectories: TrajectorySet, *, start: float = 0.0, end: float = 1.0) -> TrajectorySet
Linearly normalize the common time domain to an explicit interval.
This removes absolute time units. The original time domain is retained in provenance so the transformation is auditable.
Source code in src/eyetrajectoriespy/preprocessing.py
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 | |
eyetrajectoriespy.normalize_coordinates ¶
normalize_coordinates(trajectories: TrajectorySet, *, width: float, height: float) -> TrajectorySet
Convert planar pixel coordinates to [0, 1] normalized coordinates.
Source code in src/eyetrajectoriespy/preprocessing.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
eyetrajectoriespy.center_on_landmark ¶
center_on_landmark(trajectories: TrajectorySet, *, landmark_x: float | ndarray, landmark_y: float | ndarray) -> TrajectorySet
Express planar gaze relative to a stimulus landmark.
landmark_x and landmark_y may be scalars or one value per curve.
Source code in src/eyetrajectoriespy/preprocessing.py
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 | |
Sparse irregular PACE FPCA¶
eyetrajectoriespy.sparse_dimension_summary ¶
sparse_dimension_summary(trajectories: IrregularTrajectorySet, *, dimension: str) -> pd.DataFrame
Summarize curve-specific observation density for one sparse dimension.
Source code in src/eyetrajectoriespy/sparse.py
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 | |
eyetrajectoriespy.to_fdapy_irregular ¶
to_fdapy_irregular(trajectories: IrregularTrajectorySet, *, dimension: str)
Convert one native irregular dimension to FDApy without interpolation.
Source code in src/eyetrajectoriespy/sparse.py
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 | |
eyetrajectoriespy.fit_sparse_fpca_fdapy ¶
fit_sparse_fpca_fdapy(trajectories: IrregularTrajectorySet, *, dimension: str, n_components: int = 3, fit_smoothing: str | None = 'PS', score_smoothing: str = 'LP', tol: float = 0.0001, normalize: bool = False, evaluation_grid: ndarray | None = None, kwargs_mean: Mapping[str, Any] | None = None, kwargs_covariance: Mapping[str, Any] | None = None) -> SparseFPCAResult
Fit univariate sparse FPCA and recover scores with FDApy PACE.
The estimator uses FDApy's covariance-operator UFPCA path and PACE conditional-expectation scoring. No common-grid interpolation is performed.
Source code in src/eyetrajectoriespy/sparse.py
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 | |
eyetrajectoriespy.sparse_fpca_score_frame ¶
sparse_fpca_score_frame(result: SparseFPCAResult) -> pd.DataFrame
Return PACE scores with curve IDs and preserved curve metadata.
Source code in src/eyetrajectoriespy/sparse.py
281 282 283 284 285 286 287 288 | |
eyetrajectoriespy.plot_sparse_irregular_dimension ¶
plot_sparse_irregular_dimension(trajectories: IrregularTrajectorySet, *, dimension: str, ax=None)
Plot native irregular observations for one functional dimension.
Source code in src/eyetrajectoriespy/plotting.py
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 | |
eyetrajectoriespy.sparse_fpca_reporting_text ¶
sparse_fpca_reporting_text(result: SparseFPCAResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for sparse PACE FPCA.
Source code in src/eyetrajectoriespy/reporting.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | |
Functional mean inference¶
eyetrajectoriespy.multiplier_functional_mean_band ¶
multiplier_functional_mean_band(trajectories: TrajectorySet, *, confidence_level: float = 0.95, n_multiplier: int = 2000, unit: str = 'curve', participant_column: str | None = None, random_state: int | None = 0) -> FunctionalMeanBandResult
Estimate a simultaneous band for the functional mean on the observed grid.
The procedure uses a Gaussian multiplier bootstrap for the studentized empirical mean process and calibrates the band with the maximum absolute standardized deviation across all observed time points and functional dimensions.
With unit="participant", repeated trajectories are first averaged within participant. The estimand is therefore the equal-weight population mean of participant-average trajectories, not a curve-weighted mean.
The band is simultaneous over the observed time x dimension grid. It does not assert continuous-domain coverage between grid points.
Source code in src/eyetrajectoriespy/inference.py
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 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 | |
eyetrajectoriespy.functional_mean_band_frame ¶
functional_mean_band_frame(result: FunctionalMeanBandResult) -> pd.DataFrame
Return a long-form table of simultaneous functional-mean band values.
Source code in src/eyetrajectoriespy/inference.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
eyetrajectoriespy.plot_functional_mean_band ¶
plot_functional_mean_band(result: FunctionalMeanBandResult, *, dimension: str | None = None, ax=None)
Plot a functional mean with its simultaneous observed-grid band.
Source code in src/eyetrajectoriespy/plotting.py
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | |
eyetrajectoriespy.functional_mean_band_reporting_text ¶
functional_mean_band_reporting_text(result: FunctionalMeanBandResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for a simultaneous mean band.
Source code in src/eyetrajectoriespy/reporting.py
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | |
FPCA / MFPCA¶
eyetrajectoriespy.fit_fpca ¶
fit_fpca(trajectories: TrajectorySet, *, n_components: int | float = 0.95, scaling: str = 'none') -> FPCAResult
Fit quadrature-weighted functional PCA on one or more channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trajectories
|
TrajectorySet
|
Complete trajectories on a common grid. Missing values are rejected; users must make interpolation/exclusion decisions explicitly upstream. |
required |
n_components
|
int | float
|
Integer component count or a proportion of variance to retain. |
0.95
|
scaling
|
str
|
|
'none'
|
Source code in src/eyetrajectoriespy/fpca.py
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 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 | |
eyetrajectoriespy.fit_mfpca ¶
fit_mfpca(trajectories: TrajectorySet, *, n_components: int | float = 0.95, scaling: str = 'none') -> FPCAResult
Fit multivariate FPCA to two or more functional dimensions.
This is a semantic wrapper around :func:fit_fpca that enforces a
multivariate input and makes intent explicit in analysis scripts.
Source code in src/eyetrajectoriespy/fpca.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
eyetrajectoriespy.transform_fpca ¶
transform_fpca(result: FPCAResult, trajectories: TrajectorySet) -> np.ndarray
Project compatible trajectories into an existing FPCA basis.
Source code in src/eyetrajectoriespy/fpca.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
eyetrajectoriespy.reconstruct_fpca ¶
reconstruct_fpca(result: FPCAResult, *, scores: ndarray | None = None, n_components: int | None = None) -> np.ndarray
Reconstruct trajectories from functional principal component scores.
Source code in src/eyetrajectoriespy/fpca.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
eyetrajectoriespy.component_trajectories ¶
component_trajectories(result: FPCAResult, component: int, *, sd_multipliers: tuple[float, ...] = (-2.0, -1.0, 0.0, 1.0, 2.0)) -> np.ndarray
Return mean ± score-SD trajectories for interpreting one component.
Source code in src/eyetrajectoriespy/fpca.py
197 198 199 200 201 202 203 204 205 206 207 208 209 | |
eyetrajectoriespy.fpca_score_frame ¶
fpca_score_frame(result: FPCAResult, *, prefix: str = 'FPC')
Return component scores as a tidy pandas DataFrame.
Source code in src/eyetrajectoriespy/fpca.py
221 222 223 224 225 226 227 228 229 | |
FPCA component selection¶
eyetrajectoriespy.cross_validate_fpca_reconstruction ¶
cross_validate_fpca_reconstruction(trajectories: TrajectorySet, *, candidate_components: Sequence[int] = (1, 2, 3, 4, 5), n_splits: int = 5, scaling: str = 'none', cv_unit: str = 'curve', group_column: str | None = None, shuffle: bool = True, random_state: int | None = 0) -> FPCACrossValidationResult
Evaluate candidate FPC counts by held-out reconstruction error.
FPCA is refitted inside every training fold. With cv_unit="group", every curve sharing group_column is held out together so repeated measurements from the same participant or other grouping unit cannot leak into both train and test folds.
The function returns diagnostics only. It never chooses a component count unless select_fpca_components_cv() is called explicitly.
Source code in src/eyetrajectoriespy/selection.py
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 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 | |
eyetrajectoriespy.summarise_fpca_cross_validation ¶
summarise_fpca_cross_validation(result: FPCACrossValidationResult) -> pd.DataFrame
Aggregate fold-level held-out reconstruction errors.
Source code in src/eyetrajectoriespy/selection.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
eyetrajectoriespy.select_fpca_components_cv ¶
select_fpca_components_cv(result: FPCACrossValidationResult, *, rule: str = 'minimum') -> int
Select a component count using an explicit reconstruction-CV rule.
"minimum" selects the component count with the smallest mean fold RMSE.
"one_se" selects the smallest component count whose mean RMSE is within one standard error of the minimum-RMSE candidate. This is a parsimony heuristic rather than an inferential guarantee.
Source code in src/eyetrajectoriespy/selection.py
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 | |
eyetrajectoriespy.plot_fpca_cross_validation ¶
plot_fpca_cross_validation(result: FPCACrossValidationResult, *, ax=None)
Plot mean held-out reconstruction RMSE with fold-level SE bars.
Source code in src/eyetrajectoriespy/plotting.py
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 | |
eyetrajectoriespy.fpca_cross_validation_reporting_text ¶
fpca_cross_validation_reporting_text(result: FPCACrossValidationResult, *, rule: str = 'minimum', digits: int = 3) -> str
Generate manuscript-oriented text for held-out component selection.
Source code in src/eyetrajectoriespy/reporting.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | |
Stabilized-volatility FPCR wild-bootstrap truncation selection¶
eyetrajectoriespy.FPCAWildBootstrapTruncationScanResult
dataclass
¶
Shared-multiplier wild-bootstrap interval scan over inference truncations.
Source code in src/eyetrajectoriespy/types.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | |
eyetrajectoriespy.FPCAWildBootstrapTruncationSelectionResult
dataclass
¶
Stabilized-volatility selection from a wild-bootstrap truncation scan.
Source code in src/eyetrajectoriespy/types.py
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 | |
eyetrajectoriespy.scan_wild_bootstrap_fpca_truncations ¶
scan_wild_bootstrap_fpca_truncations(trajectories: TrajectorySet, outcome: ndarray | Series, *, candidate_components, targets: TrajectorySet | None = None, n_bootstrap: int = 1000, residual_components: int = 2, scaling: str = 'none', multiplier: str = 'normal', confidence_level: float = 0.95, independent_unit_column: str | None = None, random_state: int | None = 0) -> FPCAWildBootstrapTruncationScanResult
Scan target-wise wild-bootstrap intervals over consecutive h values.
One FPCA/MFPCA basis is fitted at the maximum candidate truncation. The same wild multiplier draw is then reused across every candidate h for a given bootstrap replicate so adjacent interval changes are not contaminated by independent Monte Carlo draws.
Residual estimation and the bootstrap pseudo-truth use k=g equal to residual_components. Every candidate h must satisfy h greater than or equal to g.
Source code in src/eyetrajectoriespy/wild_selection.py
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 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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.select_fpca_wild_bootstrap_truncation ¶
select_fpca_wild_bootstrap_truncation(scan: FPCAWildBootstrapTruncationScanResult, *, width_threshold: float, center_threshold: float, stability_run: int, on_failure: str = 'error') -> FPCAWildBootstrapTruncationSelectionResult
Select target-specific h values by the stabilized-volatility rule.
For consecutive candidate h values, a transition at h is width-stable when abs(width[h+1] - width[h]) <= width_threshold and center-stable under the analogous center threshold. A stable transition satisfies both.
stability_run is the paper's integer r. Selection therefore requires r+1 consecutive stable transitions beginning at h and chooses the earliest such h for each target.
Source code in src/eyetrajectoriespy/wild_selection.py
363 364 365 366 367 368 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 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 | |
eyetrajectoriespy.fpca_wild_bootstrap_truncation_scan_frame ¶
fpca_wild_bootstrap_truncation_scan_frame(result: FPCAWildBootstrapTruncationScanResult) -> pd.DataFrame
Return one row per candidate h and fixed target trajectory.
Source code in src/eyetrajectoriespy/wild_selection.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
eyetrajectoriespy.fpca_wild_bootstrap_truncation_selection_frame ¶
fpca_wild_bootstrap_truncation_selection_frame(result: FPCAWildBootstrapTruncationSelectionResult) -> pd.DataFrame
Return one row per target with stabilized-volatility selection.
Source code in src/eyetrajectoriespy/wild_selection.py
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 | |
eyetrajectoriespy.plot_fpca_wild_bootstrap_truncation_scan ¶
plot_fpca_wild_bootstrap_truncation_scan(result, *, target=0, metric='width', ax=None)
Plot interval width or center across candidate wild-bootstrap truncations.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.fpca_wild_bootstrap_truncation_reporting_text ¶
fpca_wild_bootstrap_truncation_reporting_text(result: FPCAWildBootstrapTruncationSelectionResult, *, digits: int = 3) -> str
Generate reporting text for stabilized-volatility truncation selection.
Source code in src/eyetrajectoriespy/reporting.py
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 | |
Heteroscedastic Gaussian FPCR wild-bootstrap projection inference¶
eyetrajectoriespy.FPCAWildBootstrapProjectionResult
dataclass
¶
Studentized wild-bootstrap inference for centered Gaussian FPCR projections.
Source code in src/eyetrajectoriespy/types.py
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 | |
eyetrajectoriespy.wild_bootstrap_fpca_projection ¶
wild_bootstrap_fpca_projection(trajectories: TrajectorySet, outcome: ndarray | Series, *, targets: TrajectorySet | None = None, n_bootstrap: int = 1000, residual_components: int = 2, inference_components: int = 3, scaling: str = 'none', multiplier: str = 'normal', confidence_level: float = 0.95, independent_unit_column: str | None = None, random_state: int | None = 0) -> FPCAWildBootstrapProjectionResult
Studentized wild-bootstrap intervals for centered Gaussian FPCR projections.
The functional regressors and their FPCA basis stay fixed. Residuals are estimated with residual_components=k. The bootstrap pseudo-truth uses the same truncation g=k. Inference uses inference_components=h and requires h greater than or equal to k.
Each pseudo-response is the k-component fitted response plus a mean-zero, variance-one wild multiplier times the k-component residual. Bootstrap projection roots are studentized with a heteroscedastic scale recomputed from the pseudo-fit residuals.
The estimand is the centered functional projection for each fixed target, relative to the training functional mean. It is not a future-outcome prediction interval and is not a clustered or repeated-participant bootstrap.
Source code in src/eyetrajectoriespy/wild_regression.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 | |
eyetrajectoriespy.fpca_wild_bootstrap_projection_frame ¶
fpca_wild_bootstrap_projection_frame(result: FPCAWildBootstrapProjectionResult) -> pd.DataFrame
Return fixed-target centered-projection wild-bootstrap summaries.
Source code in src/eyetrajectoriespy/wild_regression.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
eyetrajectoriespy.plot_fpca_wild_bootstrap_projection ¶
plot_fpca_wild_bootstrap_projection(result: FPCAWildBootstrapProjectionResult, *, max_targets: int = 30, ax=None)
Plot target-wise studentized wild-bootstrap FPCR projection intervals.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.fpca_wild_bootstrap_projection_reporting_text ¶
fpca_wild_bootstrap_projection_reporting_text(result: FPCAWildBootstrapProjectionResult, *, digits: int = 3) -> str
Generate reporting text for heteroscedastic FPCR wild-bootstrap intervals.
Source code in src/eyetrajectoriespy/reporting.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | |
Simultaneous fixed-target Gaussian FPCR wild-bootstrap inference¶
eyetrajectoriespy.FPCAWildBootstrapSimultaneousResult
dataclass
¶
Familywise simultaneous inference across fixed FPCR target projections.
Source code in src/eyetrajectoriespy/types.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 | |
eyetrajectoriespy.fpca_wild_bootstrap_projection_simultaneous_interval ¶
fpca_wild_bootstrap_projection_simultaneous_interval(result: FPCAWildBootstrapProjectionResult, *, confidence_level: float | None = None) -> FPCAWildBootstrapSimultaneousResult
Calibrate one max-|t| critical value across all fixed target projections.
The function is a post-calibration layer. It reuses the studentized roots
produced by :func:wild_bootstrap_fpca_projection and does not rerun FPCA,
score regression, residual estimation, or wild multiplier generation.
The simultaneous family is exactly the complete set of fixed targets stored
in result. To define a different family, create the base wild-bootstrap
result with that target set before calling this function.
Source code in src/eyetrajectoriespy/wild_simultaneous.py
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 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 | |
eyetrajectoriespy.fpca_wild_bootstrap_simultaneous_frame ¶
fpca_wild_bootstrap_simultaneous_frame(result: FPCAWildBootstrapSimultaneousResult) -> pd.DataFrame
Return target-wise and familywise wild-bootstrap interval summaries.
Source code in src/eyetrajectoriespy/wild_simultaneous.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 | |
eyetrajectoriespy.plot_fpca_wild_bootstrap_simultaneous_interval ¶
plot_fpca_wild_bootstrap_simultaneous_interval(result: FPCAWildBootstrapSimultaneousResult, *, max_targets: int = 30, show_targetwise: bool = True, ax=None)
Plot familywise fixed-target FPCR projection intervals.
Source code in src/eyetrajectoriespy/plotting.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | |
eyetrajectoriespy.fpca_wild_bootstrap_simultaneous_reporting_text ¶
fpca_wild_bootstrap_simultaneous_reporting_text(result: FPCAWildBootstrapSimultaneousResult, *, digits: int = 3) -> str
Generate reporting text for simultaneous fixed-target wild-bootstrap inference.
Source code in src/eyetrajectoriespy/reporting.py
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | |
Fixed-family Gaussian FPCR wild-bootstrap hypothesis tests¶
eyetrajectoriespy.FPCAWildBootstrapFamilyTestResult
dataclass
¶
Bootstrap maxT tests for a fixed family of Gaussian FPCR projections.
Source code in src/eyetrajectoriespy/types.py
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
eyetrajectoriespy.fpca_wild_bootstrap_projection_family_test ¶
fpca_wild_bootstrap_projection_family_test(result: FPCAWildBootstrapProjectionResult, *, null_values=0.0, significance_level: float = 0.05, pvalue_correction: str = 'plus_one') -> FPCAWildBootstrapFamilyTestResult
Test a fixed family of centered FPCR projection null hypotheses.
This post-processing function reuses the studentized wild-bootstrap roots stored in the supplied result. No FPCA fit, score regression, residual calculation, multiplier draw, or bootstrap replicate is rerun.
Marginal tail probabilities use each target's absolute studentized roots. Single-step adjusted probabilities use the replicate-wise maximum absolute studentized root across the complete declared target family.
The default plus-one correction avoids zero Monte Carlo p-values. Strong family-wise error control for arbitrary subsets of null hypotheses is not claimed without additional subset-pivotality conditions.
Source code in src/eyetrajectoriespy/wild_testing.py
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 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 | |
eyetrajectoriespy.fpca_wild_bootstrap_family_test_frame ¶
fpca_wild_bootstrap_family_test_frame(result: FPCAWildBootstrapFamilyTestResult) -> pd.DataFrame
Return target-level fixed-family wild-bootstrap test summaries.
Source code in src/eyetrajectoriespy/wild_testing.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
eyetrajectoriespy.plot_fpca_wild_bootstrap_family_test ¶
plot_fpca_wild_bootstrap_family_test(result: FPCAWildBootstrapFamilyTestResult, *, max_targets: int = 30, show_targetwise: bool = True, ax=None)
Plot target-wise and single-step adjusted bootstrap p-values.
Source code in src/eyetrajectoriespy/plotting.py
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 590 591 592 | |
eyetrajectoriespy.fpca_wild_bootstrap_family_test_reporting_text ¶
fpca_wild_bootstrap_family_test_reporting_text(result: FPCAWildBootstrapFamilyTestResult, *, digits: int = 3) -> str
Generate reporting text for fixed-family wild-bootstrap tests.
Source code in src/eyetrajectoriespy/reporting.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |
Wild-bootstrap finite Monte Carlo precision diagnostics¶
eyetrajectoriespy.FPCAWildBootstrapMonteCarloDiagnosticResult
dataclass
¶
Monte Carlo precision diagnostics for a fixed-family wild-bootstrap test.
Source code in src/eyetrajectoriespy/types.py
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | |
eyetrajectoriespy.fpca_wild_bootstrap_family_test_monte_carlo_diagnostics ¶
fpca_wild_bootstrap_family_test_monte_carlo_diagnostics(result: FPCAWildBootstrapFamilyTestResult, *, confidence_level: float = 0.95) -> FPCAWildBootstrapMonteCarloDiagnosticResult
Quantify finite-bootstrap Monte Carlo precision for family-test tail counts.
The diagnostic reuses the already retained bootstrap roots and does not redraw multipliers or refit any model. Exact Clopper-Pearson intervals describe uncertainty in the binomial exceedance probabilities induced by a finite number of bootstrap replicates. They are Monte Carlo diagnostics, not confidence intervals for the scientific estimand and not stronger family-wise error guarantees.
Decision-stability flags are conservative diagnostics: a reported rejection is stable only when the complete Monte Carlo interval lies below alpha; a reported non-rejection is stable only when the complete interval lies above alpha. A False flag therefore means that the finite-resample precision is insufficient to separate the tail probability from alpha at the requested diagnostic confidence level. It does not reverse the original test result.
Source code in src/eyetrajectoriespy/wild_testing.py
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 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 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 | |
eyetrajectoriespy.fpca_wild_bootstrap_monte_carlo_diagnostic_frame ¶
fpca_wild_bootstrap_monte_carlo_diagnostic_frame(result: FPCAWildBootstrapMonteCarloDiagnosticResult) -> pd.DataFrame
Return target-level Monte Carlo precision diagnostics.
Source code in src/eyetrajectoriespy/wild_testing.py
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 | |
eyetrajectoriespy.plot_fpca_wild_bootstrap_monte_carlo_diagnostics ¶
plot_fpca_wild_bootstrap_monte_carlo_diagnostics(result: FPCAWildBootstrapMonteCarloDiagnosticResult, *, max_targets: int = 30, show_targetwise: bool = False, ax=None)
Plot finite-bootstrap tail estimates with exact binomial intervals.
Source code in src/eyetrajectoriespy/plotting.py
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 656 657 658 659 660 661 662 663 664 665 | |
eyetrajectoriespy.fpca_wild_bootstrap_monte_carlo_reporting_text ¶
fpca_wild_bootstrap_monte_carlo_reporting_text(result: FPCAWildBootstrapMonteCarloDiagnosticResult, *, digits: int = 3) -> str
Generate reporting text for finite-bootstrap Monte Carlo precision.
Source code in src/eyetrajectoriespy/reporting.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | |
Gaussian FPCR future-outcome prediction¶
eyetrajectoriespy.FPCARegressionPredictionIntervalResult
dataclass
¶
Future-outcome predictive distribution for Gaussian FPCR fixed targets.
Source code in src/eyetrajectoriespy/types.py
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | |
eyetrajectoriespy.fpca_regression_future_prediction_interval ¶
fpca_regression_future_prediction_interval(result: FPCARegressionUncertaintyResult, outcome: ndarray | Series, *, confidence_level: float = 0.95, residual_method: str = 'empirical_centered', random_state: int | None = 0) -> FPCARegressionPredictionIntervalResult
Construct marginal future-outcome prediction intervals for fixed targets.
The function reuses paired-bootstrap conditional-mean predictions stored in the result and adds an independent draw from the centered empirical residual distribution of the full-sample Gaussian FPCR fit.
This is a residual-resampling predictive approximation. It assumes the response residual distribution is exchangeable across target curves and is therefore not heteroscedasticity-robust. Intervals are marginal per target, not simultaneous or joint across multiple targets.
Source code in src/eyetrajectoriespy/regression_inference.py
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 | |
eyetrajectoriespy.fpca_regression_future_prediction_frame ¶
fpca_regression_future_prediction_frame(result: FPCARegressionPredictionIntervalResult) -> pd.DataFrame
Return fixed-target future-outcome prediction interval summaries.
Source code in src/eyetrajectoriespy/regression_inference.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
eyetrajectoriespy.plot_fpca_regression_future_prediction_interval ¶
plot_fpca_regression_future_prediction_interval(result: FPCARegressionPredictionIntervalResult, *, max_targets: int = 30, ax=None)
Plot marginal future-outcome prediction intervals for fixed targets.
Source code in src/eyetrajectoriespy/plotting.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | |
eyetrajectoriespy.fpca_regression_future_prediction_reporting_text ¶
fpca_regression_future_prediction_reporting_text(result: FPCARegressionPredictionIntervalResult, *, digits: int = 3) -> str
Generate reporting text for Gaussian FPCR future-outcome intervals.
Source code in src/eyetrajectoriespy/reporting.py
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | |
Gaussian FPCR simultaneous slope band¶
eyetrajectoriespy.FPCARegressionSlopeBandResult
dataclass
¶
Observed-grid simultaneous bootstrap band for a Gaussian FPCR slope.
Source code in src/eyetrajectoriespy/types.py
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | |
eyetrajectoriespy.fpca_regression_slope_simultaneous_band ¶
fpca_regression_slope_simultaneous_band(result: FPCARegressionUncertaintyResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'global') -> FPCARegressionSlopeBandResult
Calibrate an observed-grid simultaneous band from paired FPCR bootstraps.
Global scope uses one maximum over the full observed time-by-dimension slope grid. Dimension scope calibrates one maximum over time separately within each functional dimension.
The procedure is a studentized maximum-deviation bootstrap approximation derived from already-computed paired-bootstrap slope replicates. It is not a continuous-domain confidence band and is not the operator-scaled FPCR significance test from recent asymptotic theory.
Source code in src/eyetrajectoriespy/regression_inference.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
eyetrajectoriespy.fpca_regression_slope_band_frame ¶
fpca_regression_slope_band_frame(result: FPCARegressionSlopeBandResult) -> pd.DataFrame
Return long-form observed-grid simultaneous slope-band summaries.
Source code in src/eyetrajectoriespy/regression_inference.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
eyetrajectoriespy.plot_fpca_regression_slope_band ¶
plot_fpca_regression_slope_band(result: FPCARegressionSlopeBandResult, *, dimension: str | None = None, ax=None)
Plot an observed-grid simultaneous Gaussian FPCR slope band.
Source code in src/eyetrajectoriespy/plotting.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | |
eyetrajectoriespy.fpca_regression_slope_band_reporting_text ¶
fpca_regression_slope_band_reporting_text(result: FPCARegressionSlopeBandResult, *, digits: int = 3) -> str
Generate reporting text for observed-grid simultaneous FPCR slope bands.
Source code in src/eyetrajectoriespy/reporting.py
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | |
Gaussian FPCR bootstrap uncertainty¶
eyetrajectoriespy.FPCARegressionUncertaintyResult
dataclass
¶
Paired-bootstrap uncertainty for Gaussian FPCA scalar regression.
Source code in src/eyetrajectoriespy/types.py
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | |
eyetrajectoriespy.bootstrap_fpca_regression_uncertainty ¶
bootstrap_fpca_regression_uncertainty(trajectories: TrajectorySet, outcome: ndarray | Series, *, targets: TrajectorySet | None = None, n_bootstrap: int = 500, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, level: float = 0.95, random_state: int | None = 0) -> FPCARegressionUncertaintyResult
Paired-bootstrap uncertainty for Gaussian scalar-on-function FPCR.
The independent sampling unit is resampled together with its scalar outcome. FPCA/MFPCA and the Gaussian score regression are refitted in every bootstrap replicate. The component count is held fixed.
Returned slope envelopes are pointwise percentile bootstrap summaries for the reconstructed slope in original trajectory coordinate units. Returned target intervals are uncertainty intervals for the fitted conditional mean response of fixed target curves, not prediction intervals for future noisy outcomes.
This routine does not implement the operator-scaled bootstrap test proposed in the 2026 FPCR inference literature, does not reselect the component count inside bootstrap replicates, and does not support binomial regression.
Source code in src/eyetrajectoriespy/regression_inference.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 | |
eyetrajectoriespy.fpca_regression_slope_uncertainty_frame ¶
fpca_regression_slope_uncertainty_frame(result: FPCARegressionUncertaintyResult) -> pd.DataFrame
Return long-form pointwise functional-slope uncertainty summaries.
Source code in src/eyetrajectoriespy/regression_inference.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
eyetrajectoriespy.fpca_regression_prediction_uncertainty_frame ¶
fpca_regression_prediction_uncertainty_frame(result: FPCARegressionUncertaintyResult) -> pd.DataFrame
Return fixed-target conditional-mean uncertainty summaries.
Source code in src/eyetrajectoriespy/regression_inference.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | |
eyetrajectoriespy.plot_fpca_regression_slope_uncertainty ¶
plot_fpca_regression_slope_uncertainty(result: FPCARegressionUncertaintyResult, *, dimension: str | None = None, ax=None)
Plot the Gaussian FPCR slope with pointwise bootstrap uncertainty.
Source code in src/eyetrajectoriespy/plotting.py
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | |
eyetrajectoriespy.plot_fpca_regression_mean_prediction_uncertainty ¶
plot_fpca_regression_mean_prediction_uncertainty(result: FPCARegressionUncertaintyResult, *, max_targets: int = 30, ax=None)
Plot fixed-target conditional-mean uncertainty from paired FPCR bootstrap.
Source code in src/eyetrajectoriespy/plotting.py
853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | |
eyetrajectoriespy.fpca_regression_uncertainty_reporting_text ¶
fpca_regression_uncertainty_reporting_text(result: FPCARegressionUncertaintyResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for Gaussian FPCR bootstrap uncertainty.
Source code in src/eyetrajectoriespy/reporting.py
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | |
Predictive FPCA regression selection¶
eyetrajectoriespy.cross_validate_fpca_regression ¶
cross_validate_fpca_regression(trajectories: TrajectorySet, outcome: ndarray | Series, *, candidate_components: Sequence[int] = (1, 2, 3, 4, 5), family: str = 'gaussian', loss: str | None = None, covariates: DataFrame | None = None, n_splits: int = 5, scaling: str = 'none', cv_unit: str = 'curve', group_column: str | None = None, shuffle: bool = True, random_state: int | None = 0) -> FPCARegressionCVResult
Tune retained FPC count for scalar-outcome prediction.
FPCA and scalar regression are both fitted inside every training fold. Group cross-validation holds all curves from a participant/group together. The function tunes an ordinary unsupervised FPCA basis for prediction; it does not construct supervised principal components.
Source code in src/eyetrajectoriespy/prediction.py
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 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 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
eyetrajectoriespy.summarise_fpca_regression_cv ¶
summarise_fpca_regression_cv(result: FPCARegressionCVResult) -> pd.DataFrame
Aggregate fold-level predictive loss by candidate FPC count.
Source code in src/eyetrajectoriespy/prediction.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
eyetrajectoriespy.select_fpca_regression_components ¶
select_fpca_regression_components(result: FPCARegressionCVResult, *, rule: str = 'minimum') -> int
Choose retained FPC count from predictive CV losses.
Source code in src/eyetrajectoriespy/prediction.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
eyetrajectoriespy.nested_cross_validate_fpca_regression ¶
nested_cross_validate_fpca_regression(trajectories: TrajectorySet, outcome: ndarray | Series, *, candidate_components: Sequence[int] = (1, 2, 3, 4, 5), family: str = 'gaussian', loss: str | None = None, covariates: DataFrame | None = None, outer_splits: int = 5, inner_splits: int = 4, selection_rule: str = 'minimum', scaling: str = 'none', cv_unit: str = 'curve', group_column: str | None = None, shuffle: bool = True, random_state: int | None = 0) -> FPCANestedRegressionCVResult
Estimate predictive performance with nested FPC-count selection.
Source code in src/eyetrajectoriespy/prediction.py
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 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | |
eyetrajectoriespy.plot_fpca_regression_cv ¶
plot_fpca_regression_cv(result: FPCARegressionCVResult, *, ax=None)
Plot mean held-out predictive loss against retained FPC count.
Source code in src/eyetrajectoriespy/plotting.py
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
eyetrajectoriespy.plot_nested_fpca_regression_cv ¶
plot_nested_fpca_regression_cv(result: FPCANestedRegressionCVResult, *, ax=None)
Plot outer-fold predictive loss from nested FPCA regression CV.
Source code in src/eyetrajectoriespy/plotting.py
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | |
eyetrajectoriespy.fpca_regression_cv_reporting_text ¶
fpca_regression_cv_reporting_text(result: FPCARegressionCVResult, *, rule: str = 'minimum', digits: int = 3) -> str
Generate manuscript-oriented text for outcome-tuned FPC selection.
Source code in src/eyetrajectoriespy/reporting.py
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | |
eyetrajectoriespy.fpca_nested_regression_cv_reporting_text ¶
fpca_nested_regression_cv_reporting_text(result: FPCANestedRegressionCVResult, *, digits: int = 3) -> str
Describe nested predictive performance after inner FPC-count selection.
Source code in src/eyetrajectoriespy/reporting.py
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | |
FPC shape uncertainty¶
eyetrajectoriespy.FPCAComponentBandResult
dataclass
¶
Bootstrap-calibrated simultaneous uncertainty bands for FPC functions.
Source code in src/eyetrajectoriespy/types.py
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 | |
eyetrajectoriespy.bootstrap_fpca_component_bands ¶
bootstrap_fpca_component_bands(trajectories: TrajectorySet, *, n_bootstrap: int = 500, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, confidence_level: float = 0.95, simultaneous_scope: str = 'component', relative_gap_threshold: float | None = None, on_near_tie: str = 'error', random_state: int | None = 0) -> FPCAComponentBandResult
Estimate matched-bootstrap simultaneous bands for individual FPC shapes.
Bootstrap FPCs are matched to the full-sample reference by maximum absolute functional similarity and sign-aligned before uncertainty is calibrated. Pointwise bootstrap standard errors are combined with a studentized maximum absolute deviation over the observed time-by-dimension grid.
Component scope calibrates each FPC separately across its full observed grid. Family scope uses a single maximum across all requested FPCs and the grid, providing a more conservative familywise band.
Because individual eigenfunctions can be weakly identified when adjacent eigenvalues are close, relative_gap_threshold optionally performs an explicit descriptive identifiability screen. No universal threshold is imposed by default. If supplied, on_near_tie controls whether a retained FPC meeting the threshold raises, warns, or is recorded only.
These are bootstrap-calibrated simultaneous uncertainty bands over the observed grid. They do not assert exact finite-sample coverage or coverage between sampled time points.
Source code in src/eyetrajectoriespy/component_inference.py
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 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 | |
eyetrajectoriespy.fpca_component_band_frame ¶
fpca_component_band_frame(result: FPCAComponentBandResult) -> pd.DataFrame
Return long-form values for simultaneous FPC uncertainty bands.
Source code in src/eyetrajectoriespy/component_inference.py
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 | |
eyetrajectoriespy.plot_fpca_component_band ¶
plot_fpca_component_band(result: FPCAComponentBandResult, *, component: int = 0, dimension: str | None = None, ax=None)
Plot an FPC with its bootstrap-calibrated simultaneous uncertainty band.
Source code in src/eyetrajectoriespy/plotting.py
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 | |
eyetrajectoriespy.fpca_component_band_reporting_text ¶
fpca_component_band_reporting_text(result: FPCAComponentBandResult, *, digits: int = 2) -> str
Generate manuscript-oriented wording for simultaneous FPC uncertainty bands.
Source code in src/eyetrajectoriespy/reporting.py
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | |
eyetrajectoriespy.bootstrap_fpca_component_envelopes ¶
bootstrap_fpca_component_envelopes(trajectories: TrajectorySet, *, n_bootstrap: int = 200, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, level: float = 0.95, random_state: int | None = 0) -> FPCAComponentEnvelopeResult
Create pointwise descriptive envelopes from matched bootstrap FPCs.
Every bootstrap fit is matched to the full-sample reference components by maximum absolute functional similarity and sign-aligned before pointwise quantiles are calculated.
The returned envelopes summarize resampling variation. They are not simultaneous confidence bands and do not provide calibrated coverage guarantees.
Source code in src/eyetrajectoriespy/stability.py
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 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 | |
eyetrajectoriespy.plot_fpca_component_envelope ¶
plot_fpca_component_envelope(result: FPCAComponentEnvelopeResult, *, component: int = 0, dimension: str | None = None, ax=None)
Plot a reference FPC with its descriptive matched-bootstrap envelope.
Source code in src/eyetrajectoriespy/plotting.py
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | |
eyetrajectoriespy.fpca_component_envelope_reporting_text ¶
fpca_component_envelope_reporting_text(result: FPCAComponentEnvelopeResult, *, digits: int = 2) -> str
Describe matched-bootstrap FPC envelopes without confidence-band claims.
Source code in src/eyetrajectoriespy/reporting.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | |
FPC score basis uncertainty¶
eyetrajectoriespy.FPCAScoreUncertaintyResult
dataclass
¶
Basis-resampling uncertainty for FPCA scores of fixed target curves.
Source code in src/eyetrajectoriespy/types.py
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
eyetrajectoriespy.bootstrap_fpca_score_uncertainty ¶
bootstrap_fpca_score_uncertainty(trajectories: TrajectorySet, *, targets: TrajectorySet | None = None, n_bootstrap: int = 500, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, level: float = 0.95, random_state: int | None = 0) -> FPCAScoreUncertaintyResult
Quantify FPC score sensitivity to re-estimation of the FPCA basis.
The training trajectories are resampled and FPCA is refitted in every bootstrap replicate. Bootstrap FPCs are matched to the full-sample reference by maximum absolute functional similarity and sign-aligned. Fixed target trajectories are then projected into each aligned bootstrap basis.
The returned percentile envelopes quantify basis-resampling uncertainty for fixed target curves. They do not include target measurement error, uncertainty about a latent target trajectory, conditional PACE score uncertainty, future-curve sampling variability, or uncertainty from preprocessing decisions. They are descriptive bootstrap uncertainty summaries rather than exact finite-sample confidence intervals.
Source code in src/eyetrajectoriespy/score_uncertainty.py
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 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 | |
eyetrajectoriespy.fpca_score_uncertainty_frame ¶
fpca_score_uncertainty_frame(result: FPCAScoreUncertaintyResult) -> pd.DataFrame
Return tidy fixed-target score uncertainty summaries.
Source code in src/eyetrajectoriespy/score_uncertainty.py
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 | |
eyetrajectoriespy.plot_fpca_score_uncertainty ¶
plot_fpca_score_uncertainty(result: FPCAScoreUncertaintyResult, *, component: int = 0, max_targets: int = 30, ax=None)
Plot fixed-target score uncertainty from bootstrap basis re-estimation.
Source code in src/eyetrajectoriespy/plotting.py
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
eyetrajectoriespy.fpca_score_uncertainty_reporting_text ¶
fpca_score_uncertainty_reporting_text(result: FPCAScoreUncertaintyResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for basis-resampled FPC scores.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
FPCA spectrum uncertainty¶
eyetrajectoriespy.FPCASpectrumUncertaintyResult
dataclass
¶
Bootstrap uncertainty for matched FPCA eigenvalues and variance spectra.
Source code in src/eyetrajectoriespy/types.py
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 | |
eyetrajectoriespy.bootstrap_fpca_spectrum_uncertainty ¶
bootstrap_fpca_spectrum_uncertainty(trajectories: TrajectorySet, *, n_bootstrap: int = 500, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, confidence_level: float = 0.95, simultaneous_scope: str = 'component', random_state: int | None = 0) -> FPCASpectrumUncertaintyResult
Bootstrap uncertainty for matched FPCA eigenvalues and variance ratios.
Bootstrap FPCs are matched to the full-sample reference by maximum absolute functional similarity before eigenvalues and explained-variance ratios are attached to reference component identities.
Component scope calibrates each component separately. Family scope controls the maximum across all requested components within each spectrum metric: eigenvalue, explained-variance ratio, or cumulative explained variance. It is not a joint guarantee across the three different metrics.
Intervals are symmetric studentized bootstrap approximations around the full-sample estimate. They are not clipped to parameter support, so a finite sample interval may extend below zero or outside [0, 1].
Source code in src/eyetrajectoriespy/spectrum_inference.py
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 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 | |
eyetrajectoriespy.fpca_spectrum_uncertainty_frame ¶
fpca_spectrum_uncertainty_frame(result: FPCASpectrumUncertaintyResult) -> pd.DataFrame
Return component-level FPCA spectrum estimates and uncertainty intervals.
Source code in src/eyetrajectoriespy/spectrum_inference.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
eyetrajectoriespy.plot_fpca_spectrum_uncertainty ¶
plot_fpca_spectrum_uncertainty(result: FPCASpectrumUncertaintyResult, *, metric: str = 'explained_variance_ratio', ax=None)
Plot FPCA spectrum estimates with bootstrap-calibrated uncertainty bars.
Source code in src/eyetrajectoriespy/plotting.py
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
eyetrajectoriespy.fpca_spectrum_uncertainty_reporting_text ¶
fpca_spectrum_uncertainty_reporting_text(result: FPCASpectrumUncertaintyResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for FPCA spectrum uncertainty.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
Near-tied eigenvalues and eigenspaces¶
eyetrajectoriespy.fpca_eigenvalue_gap_table ¶
fpca_eigenvalue_gap_table(result: FPCAResult, *, relative_gap_threshold: float | None = None) -> pd.DataFrame
Return adjacent retained-eigenvalue gap diagnostics.
The table is descriptive. A relative_gap_threshold is optional and, when supplied, creates an explicit near_tie_flag. No threshold is imposed by default because the meaning of a practically small eigengap depends on the study, sample size, and downstream interpretation.
Only gaps between retained components can be calculated from the supplied fit. To inspect the gap at a proposed retention boundary, fit at least one component beyond that boundary.
Source code in src/eyetrajectoriespy/subspace.py
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 69 70 71 72 73 74 75 76 | |
eyetrajectoriespy.compare_fpca_subspaces ¶
compare_fpca_subspaces(reference: FPCAResult, candidate: FPCAResult, *, start_component: int = 0, n_components: int = 2) -> FPCASubspaceComparisonResult
Compare corresponding FPC subspaces using principal angles.
This diagnostic is invariant to sign changes, permutations, and rotations within the selected subspace. It is useful when adjacent eigenvalues are close and individual FPC labels can swap or rotate.
normalized_projector_distance lies in [0, 1], where zero indicates identical subspaces. It is the Frobenius distance between the two projection operators divided by sqrt(2 * n_components).
Source code in src/eyetrajectoriespy/subspace.py
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 | |
eyetrajectoriespy.bootstrap_fpca_subspace_stability ¶
bootstrap_fpca_subspace_stability(trajectories: TrajectorySet, *, start_component: int = 0, n_components: int = 2, n_bootstrap: int = 200, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, random_state: int | None = 0) -> FPCASubspaceStabilityResult
Bootstrap stability of a contiguous FPCA eigenspace.
The same ranked component block is compared between the full-sample fit and each bootstrap fit using principal angles. Individual FPC matching is not required, so rotations or swaps within the selected block do not create false instability.
The result is descriptive and does not test equality of population eigenspaces.
Source code in src/eyetrajectoriespy/subspace.py
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 | |
eyetrajectoriespy.summarise_fpca_subspace_stability ¶
summarise_fpca_subspace_stability(result: FPCASubspaceStabilityResult, *, interval: tuple[float, float] = (0.025, 0.975)) -> pd.DataFrame
Summarize bootstrap principal-angle and projector-distance stability.
Source code in src/eyetrajectoriespy/subspace.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
eyetrajectoriespy.plot_fpca_subspace_stability ¶
plot_fpca_subspace_stability(result: FPCASubspaceStabilityResult, *, metric: str = 'normalized_projector_distance', ax=None)
Plot bootstrap eigenspace stability across resamples.
Source code in src/eyetrajectoriespy/plotting.py
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | |
eyetrajectoriespy.fpca_eigengap_reporting_text ¶
fpca_eigengap_reporting_text(result: FPCAResult, *, relative_gap_threshold: float | None = None, digits: int = 3) -> str
Generate descriptive text for adjacent retained FPCA eigengaps.
Source code in src/eyetrajectoriespy/reporting.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | |
eyetrajectoriespy.fpca_subspace_stability_reporting_text ¶
fpca_subspace_stability_reporting_text(result: FPCASubspaceStabilityResult, *, digits: int = 3) -> str
Generate descriptive text for bootstrap FPCA eigenspace stability.
Source code in src/eyetrajectoriespy/reporting.py
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | |
Split-conformal FPCA anomaly review¶
eyetrajectoriespy.ConformalFunctionalAnomalyResult
dataclass
¶
Split-conformal anomaly p-values for new functional trajectories.
Source code in src/eyetrajectoriespy/types.py
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 | |
eyetrajectoriespy.split_conformal_fpca_anomaly ¶
split_conformal_fpca_anomaly(proper_training: TrajectorySet, calibration: TrajectorySet, targets: TrajectorySet, *, n_components: int = 3, scaling: str = 'none', nonconformity: str = 'reconstruction_rmse', mahalanobis_covariance: str | None = None, alpha: float = 0.05, random_state: int | None = 0) -> ConformalFunctionalAnomalyResult
Compute marginal split-conformal anomaly p-values for new trajectories.
The FPCA/MFPCA reference and any score-space covariance estimator are fitted on the proper-training set only. Calibration and target trajectories are scored without refitting the reference.
P-values use the conservative split-conformal rule
(1 + number of calibration scores >= target score) / (n_calibration + 1).
Review flags are p <= alpha and are never automatic exclusions.
The finite-sample marginal conformal interpretation requires exchangeable inlier trajectories at the curve level and a proper-training/calibration reference population appropriate for the targets. This function does not implement calibration-conditional adjustments or multiple-testing/FDR control.
Source code in src/eyetrajectoriespy/conformal.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
eyetrajectoriespy.conformal_fpca_anomaly_frame ¶
conformal_fpca_anomaly_frame(result: ConformalFunctionalAnomalyResult) -> pd.DataFrame
Return target split-conformal anomaly results as a tidy table.
Source code in src/eyetrajectoriespy/conformal.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
eyetrajectoriespy.plot_conformal_fpca_anomaly ¶
plot_conformal_fpca_anomaly(result: ConformalFunctionalAnomalyResult, *, max_targets: int = 50, ax=None)
Plot marginal split-conformal anomaly p-values for target trajectories.
Source code in src/eyetrajectoriespy/plotting.py
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | |
eyetrajectoriespy.conformal_fpca_anomaly_reporting_text ¶
conformal_fpca_anomaly_reporting_text(result: ConformalFunctionalAnomalyResult, *, digits: int = 3) -> str
Generate reporting text for split-conformal FPCA anomaly review.
Source code in src/eyetrajectoriespy/reporting.py
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | |
Functional outliers and influence¶
eyetrajectoriespy.diagnose_fpca_outliers ¶
diagnose_fpca_outliers(result: FPCAResult, trajectories: TrajectorySet, *, n_components: int | None = None, reconstruction_z_threshold: float = 3.5, score_alpha: float = 0.99, score_covariance: str = 'robust', random_state: int | None = 0) -> FunctionalOutlierResult
Screen fitted trajectories using reconstruction and FPCA-score diagnostics.
Review flags are diagnostics only. The package never removes flagged trajectories automatically.
Source code in src/eyetrajectoriespy/outliers.py
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 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 | |
eyetrajectoriespy.leave_one_group_out_fpca_influence ¶
leave_one_group_out_fpca_influence(trajectories: TrajectorySet, *, group_column: str | None = None, n_components: int = 3, scaling: str = 'none') -> FPCAInfluenceResult
Quantify how much each curve or group influences fitted FPC structure.
When group_column is supplied, all curves belonging to one group are removed together. For repeated-trial eye-tracking designs this is commonly a participant identifier.
Source code in src/eyetrajectoriespy/outliers.py
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 | |
eyetrajectoriespy.detect_functional_outliers_skfda ¶
detect_functional_outliers_skfda(trajectories: TrajectorySet, *, dimension: str, method: str = 'boxplot', factor: float = 1.5, random_state: int | None = 0) -> FunctionalOutlierResult
Run optional scikit-fda outlier screening on one functional dimension.
Returned review flags are diagnostic only and never modify trajectories.
Source code in src/eyetrajectoriespy/backends.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 | |
eyetrajectoriespy.plot_fpca_outlier_diagnostics ¶
plot_fpca_outlier_diagnostics(result: FunctionalOutlierResult, *, ax=None)
Plot reconstruction robust-z against score-space Mahalanobis distance.
Source code in src/eyetrajectoriespy/plotting.py
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
eyetrajectoriespy.plot_fpca_influence ¶
plot_fpca_influence(result: FPCAInfluenceResult, *, metric: str = 'min_abs_component_similarity', ax=None)
Plot leave-one-group-out FPCA influence summaries.
Source code in src/eyetrajectoriespy/plotting.py
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | |
eyetrajectoriespy.fpca_outlier_reporting_text ¶
fpca_outlier_reporting_text(result: FunctionalOutlierResult) -> str
Generate descriptive text for functional review diagnostics.
Source code in src/eyetrajectoriespy/reporting.py
596 597 598 599 600 601 602 603 604 605 606 607 | |
eyetrajectoriespy.fpca_influence_reporting_text ¶
fpca_influence_reporting_text(result: FPCAInfluenceResult, *, digits: int = 2) -> str
Generate descriptive text for leave-one-group-out FPCA influence.
Source code in src/eyetrajectoriespy/reporting.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | |
FPCA stability and reconstruction¶
eyetrajectoriespy.component_similarity_matrix ¶
component_similarity_matrix(reference: FPCAResult, candidate: FPCAResult, *, n_components: int | None = None) -> np.ndarray
Signed integrated cosine similarity between two FPCA component sets.
Components are compared in the standardized functional geometry used by each fit so explicit channel scaling does not distort matching.
Source code in src/eyetrajectoriespy/stability.py
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 | |
eyetrajectoriespy.match_fpca_components ¶
match_fpca_components(reference: FPCAResult, candidate: FPCAResult, *, n_components: int | None = None) -> tuple[np.ndarray, np.ndarray]
Match candidate FPCs to reference FPCs by maximum absolute similarity.
Returns:
| Name | Type | Description |
|---|---|---|
assignments |
ndarray
|
Candidate component index matched to each reference component. |
signed_similarity |
ndarray
|
Signed similarity after matching. Sign is retained because FPC orientation is arbitrary and should be inspected explicitly. |
Source code in src/eyetrajectoriespy/stability.py
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 | |
eyetrajectoriespy.bootstrap_fpca_stability ¶
bootstrap_fpca_stability(trajectories: TrajectorySet, *, n_bootstrap: int = 200, n_components: int = 3, scaling: str = 'none', resample_unit: str = 'curve', participant_column: str | None = None, random_state: int | None = 0) -> FPCAStabilityResult
Estimate descriptive FPC stability under nonparametric bootstrap.
Component labels are matched to the full-sample reference by maximum absolute functional similarity. Returned bootstrap fractions are descriptive stability summaries, not probabilities that a component is scientifically true.
Source code in src/eyetrajectoriespy/stability.py
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 | |
eyetrajectoriespy.summarise_fpca_stability ¶
summarise_fpca_stability(result: FPCAStabilityResult, *, similarity_threshold: float = 0.8, interval: tuple[float, float] = (0.025, 0.975)) -> pd.DataFrame
Summarize matched FPC stability across bootstrap replicates.
Source code in src/eyetrajectoriespy/stability.py
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 | |
eyetrajectoriespy.reconstruction_error_by_curve ¶
reconstruction_error_by_curve(result: FPCAResult, trajectories: TrajectorySet, *, n_components: int | None = None) -> pd.DataFrame
Integrated root-mean-square reconstruction error for each trajectory.
Source code in src/eyetrajectoriespy/stability.py
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 | |
eyetrajectoriespy.fpca_reconstruction_curve ¶
fpca_reconstruction_curve(result: FPCAResult, trajectories: TrajectorySet) -> pd.DataFrame
Overall reconstruction error as the retained component count increases.
Source code in src/eyetrajectoriespy/stability.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
Registration and phase¶
eyetrajectoriespy.register_to_landmarks ¶
register_to_landmarks(trajectories: TrajectorySet, observed_landmarks: ndarray, *, reference_landmarks: ndarray | None = None, interpolation: str = 'linear', max_gap: float | None = None) -> RegistrationResult
Register trajectories using monotone piecewise-linear landmark warping.
The returned warping function h_i(t) maps reference time to the
corresponding time in each original trajectory. Registered curves are
therefore evaluated as G_i(h_i(t)).
Notes
The function preserves both the original trajectories and the warping functions so phase information is not lost from the analysis record.
Source code in src/eyetrajectoriespy/registration.py
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 108 109 110 111 | |
eyetrajectoriespy.warping_displacement ¶
warping_displacement(result: RegistrationResult) -> np.ndarray
Return h_i(t) - t for each curve and grid point.
Source code in src/eyetrajectoriespy/registration.py
114 115 116 117 | |
eyetrajectoriespy.phase_summary ¶
phase_summary(result: RegistrationResult) -> dict[str, np.ndarray]
Summarize phase/warping magnitude without discarding the full functions.
Source code in src/eyetrajectoriespy/registration.py
120 121 122 123 124 125 126 127 128 | |
eyetrajectoriespy.phase_trajectory_set ¶
phase_trajectory_set(registration: RegistrationResult, *, representation: str = 'displacement') -> TrajectorySet
Convert registration warpings into a one-dimensional functional object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
representation
|
str
|
"displacement" returns h_i(t) - t. "warping" returns h_i(t). |
'displacement'
|
Source code in src/eyetrajectoriespy/phase.py
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 | |
eyetrajectoriespy.fit_phase_fpca ¶
fit_phase_fpca(registration: RegistrationResult, *, representation: str = 'displacement', n_components: int | float = 0.95) -> FPCAResult
Fit univariate FPCA to registration-derived phase functions.
Source code in src/eyetrajectoriespy/phase.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
eyetrajectoriespy.phase_landmark_frame ¶
phase_landmark_frame(registration: RegistrationResult) -> pd.DataFrame
Return observed-minus-reference landmark timing deviations by curve.
Source code in src/eyetrajectoriespy/phase.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
eyetrajectoriespy.compare_registered_unregistered_fpca ¶
compare_registered_unregistered_fpca(registration: RegistrationResult, *, n_components: int = 3, scaling: str = 'none') -> RegistrationSensitivityResult
Compare dominant FPCs before and after explicit registration.
Component functions are matched by maximum absolute functional similarity. Score correlations use sign-aligned registered scores and quantify whether participant/trial ordering is preserved after timing alignment.
Source code in src/eyetrajectoriespy/phase.py
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 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 | |
eyetrajectoriespy.registration_sensitivity_frame ¶
registration_sensitivity_frame(result: RegistrationSensitivityResult) -> pd.DataFrame
Return a tidy component-level registration sensitivity table.
Source code in src/eyetrajectoriespy/phase.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
Multilevel and compositional¶
eyetrajectoriespy.fit_multilevel_fpca ¶
fit_multilevel_fpca(trajectories: TrajectorySet, *, participant_column: str, participant_components: int | float = 0.95, trial_components: int | float = 0.95, scaling: str = 'none') -> MultilevelFPCAResult
Separate between-participant and within-participant functional variation.
This implements a transparent two-level functional ANOVA decomposition:
G_ij(t) = mu(t) + U_i(t) + V_ij(t)
FPCA is then fitted separately to participant mean deviations U_i and
trial residuals V_ij. It is appropriate for repeated trial designs when
the goal is to avoid mixing stable participant differences with trial-level
functional variability.
Source code in src/eyetrajectoriespy/multilevel.py
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 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 | |
eyetrajectoriespy.fit_compositional_fpca ¶
fit_compositional_fpca(trajectories: TrajectorySet, *, reference_dimension: int = -1, epsilon: float = 1e-08, n_components: int | float = 0.95, scaling: str = 'none') -> CompositionalFPCAResult
Fit FPCA to AOI probability functions while respecting the simplex.
The implementation applies an additive log-ratio transform before MFPCA.
Reconstructed trajectories can be mapped back exactly to the simplex with
:func:reconstruct_compositional_fpca.
Source code in src/eyetrajectoriespy/compositional.py
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 | |
eyetrajectoriespy.reconstruct_compositional_fpca ¶
reconstruct_compositional_fpca(result: CompositionalFPCAResult, *, scores: ndarray | None = None, n_components: int | None = None) -> np.ndarray
Reconstruct AOI probability trajectories that sum to one.
Source code in src/eyetrajectoriespy/compositional.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
Derived functions¶
eyetrajectoriespy.speed_function ¶
speed_function(trajectories: TrajectorySet) -> TrajectorySet
Compute the Euclidean speed function of a planar gaze path.
Source code in src/eyetrajectoriespy/kinematics.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
eyetrajectoriespy.acceleration_magnitude_function ¶
acceleration_magnitude_function(trajectories: TrajectorySet) -> TrajectorySet
Compute Euclidean acceleration magnitude for planar trajectories.
Source code in src/eyetrajectoriespy/kinematics.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
eyetrajectoriespy.distance_to_landmark_function ¶
distance_to_landmark_function(trajectories: TrajectorySet, *, landmark_x: float | ndarray, landmark_y: float | ndarray) -> TrajectorySet
Compute continuous Euclidean distance from gaze to a spatial landmark.
Source code in src/eyetrajectoriespy/kinematics.py
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 122 123 | |
eyetrajectoriespy.cumulative_path_length ¶
cumulative_path_length(trajectories: TrajectorySet) -> TrajectorySet
Compute cumulative 2-D path length as a function of trial time.
Source code in src/eyetrajectoriespy/kinematics.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
eyetrajectoriespy.heading_function ¶
heading_function(trajectories: TrajectorySet, *, dimensions: Sequence[str] | None = None, min_speed: float = 0.0, undefined_policy: str = 'nan') -> TrajectorySet
Compute wrapped planar heading in radians without smoothing or unwrapping.
Source code in src/eyetrajectoriespy/kinematics.py
300 301 302 303 304 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 | |
eyetrajectoriespy.signed_curvature_function ¶
signed_curvature_function(trajectories: TrajectorySet, *, dimensions: Sequence[str] | None = None, min_speed: float = 0.0, undefined_policy: str = 'nan') -> TrajectorySet
Compute signed planar curvature without hidden denominator stabilization.
Source code in src/eyetrajectoriespy/kinematics.py
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 383 384 385 386 387 388 | |
eyetrajectoriespy.turning_rate_function ¶
turning_rate_function(trajectories: TrajectorySet, *, dimensions: Sequence[str] | None = None, min_speed: float = 0.0, undefined_policy: str = 'nan') -> TrajectorySet
Compute signed heading-change rate directly from planar derivatives.
Source code in src/eyetrajectoriespy/kinematics.py
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 | |
eyetrajectoriespy.trajectory_tortuosity ¶
trajectory_tortuosity(trajectories: TrajectorySet, *, dimensions: Sequence[str] | None = None, min_displacement: float = 0.0, undefined_policy: str = 'nan') -> pd.DataFrame
Return path-length / endpoint-displacement tortuosity per curve.
Source code in src/eyetrajectoriespy/kinematics.py
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 | |
Functional mixed-effects regression¶
eyetrajectoriespy.FunctionalMixedEffectsResult
dataclass
¶
Joint Gaussian functional mixed-effects regression fit.
Source code in src/eyetrajectoriespy/types.py
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | |
eyetrajectoriespy.fit_functional_mixed_effects_regression ¶
fit_functional_mixed_effects_regression(trajectories: TrajectorySet, design: DataFrame, predictors: Sequence[str], *, participant_column: str, dimension: str, fixed_basis_size: int = 6, random_basis_size: int = 4, random_slope_predictor: str | None = None, trial_column: str | None = None, trial_random_effect: str | None = None, trial_random_basis_size: int = 3, residual_correlation: str = 'iid', spline_degree: int = 3, reml: bool = True, method: str = 'lbfgs', maxiter: int = 500) -> FunctionalMixedEffectsResult
Fit one joint Gaussian functional mixed-effects model.
The base model contains a participant functional random intercept. When random_slope_predictor explicitly names one declared fixed predictor, the model adds exactly one participant random functional slope for that predictor.
Fixed coefficient functions, the participant functional random intercept, and the optional random functional slope use explicitly sized clamped B-spline bases. Version 0.45 uses one common random basis size for the intercept and the single slope, with one unstructured covariance over the stacked random-basis coefficient vector.
Version 0.48 optionally adds one nested trial-level functional random intercept through an explicit profiled Gaussian marginal-likelihood backend. Version 0.49 extends that backend with explicit within-trial residual correlation: physical-time exponential correlation on arbitrary strictly increasing common grids, or index-step AR(1) on equally spaced grids. Residual correlation is block diagonal by source curve/trial and is never allowed to cross trial boundaries.
The historical statsmodels MixedLM path is preserved exactly for the
backward-compatible participant-only residual_correlation="iid" model.
No random-slope predictor, trial random effect, residual-correlation family, basis size, interaction, or optimizer fallback is selected automatically.
Source code in src/eyetrajectoriespy/functional_mixed_effects.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 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 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
eyetrajectoriespy.functional_mixed_effects_coefficient_frame ¶
functional_mixed_effects_coefficient_frame(result: FunctionalMixedEffectsResult, *, band: FunctionalMixedEffectsBandResult | None = None) -> pd.DataFrame
Return fixed-effect coefficient functions and optional simultaneous bands.
Source code in src/eyetrajectoriespy/functional_mixed_effects.py
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | |
eyetrajectoriespy.plot_functional_mixed_effects_coefficient ¶
plot_functional_mixed_effects_coefficient(result: FunctionalMixedEffectsResult | FunctionalMixedEffectsBandResult, *, coefficient: str | int, ax=None)
Plot one mixed-effects coefficient with pointwise or simultaneous uncertainty.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.functional_mixed_effects_reporting_text ¶
functional_mixed_effects_reporting_text(result: FunctionalMixedEffectsResult, *, band: FunctionalMixedEffectsBandResult | None = None) -> str
Generate manuscript-oriented wording for a functional mixed-effects fit.
Source code in src/eyetrajectoriespy/reporting.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 383 384 385 386 387 388 | |
eyetrajectoriespy.functional_mixed_effects_whitened_residuals ¶
functional_mixed_effects_whitened_residuals(result: FunctionalMixedEffectsResult) -> np.ndarray
Return conditional residual functions whitened within each trial.
Whitening uses the fitted residual covariance only. Random effects remain conditioned on their fitted BLUPs, so these are model-scale diagnostic residuals rather than independent observations with parameter uncertainty removed.
Source code in src/eyetrajectoriespy/functional_mixed_effects_nested.py
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 383 384 385 386 387 388 389 | |
eyetrajectoriespy.FunctionalMixedEffectsResidualDiagnosticsResult
dataclass
¶
Descriptive within-trial residual-dependence diagnostics.
Source code in src/eyetrajectoriespy/types.py
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | |
eyetrajectoriespy.functional_mixed_effects_residual_diagnostics ¶
functional_mixed_effects_residual_diagnostics(result: FunctionalMixedEffectsResult, *, max_lag: int, residual_scale: Literal['raw', 'whitened'] = 'raw') -> FunctionalMixedEffectsResidualDiagnosticsResult
Compute descriptive residual-dependence diagnostics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
FunctionalMixedEffectsResult
|
Converged likelihood-based functional mixed-effects fit. |
required |
max_lag
|
int
|
Largest within-trial index lag to inspect. The value is always explicit; no automatic lag selection is performed. |
required |
Returns:
| Type | Description |
|---|---|
FunctionalMixedEffectsResidualDiagnosticsResult
|
Trial-level diagnostics plus pair-count-weighted participant and overall summaries. |
Notes
Diagnostics use the fitted model's conditional residual functions. For trial j with residuals r_j(t_m), the within-trial centered residual is
e_j(t_m) = r_j(t_m) - mean_m r_j(t_m).
At index lag h, autocovariance is the mean of e_j(t_m)e_j(t_{m+h}), autocorrelation divides by the lag-zero autocovariance, and semivariance is half the mean squared residual difference. Trials with exactly zero residual variance are retained; autocorrelation is undefined (NaN) and explicitly counted in summaries.
The common time grid is not assumed equally spaced. Each index lag retains
its mean, minimum, and maximum physical time separation. Use
:func:functional_mixed_effects_residual_pair_frame when the exact
physical lag for every residual pair is needed.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
eyetrajectoriespy.functional_mixed_effects_residual_diagnostic_frame ¶
functional_mixed_effects_residual_diagnostic_frame(result: FunctionalMixedEffectsResidualDiagnosticsResult, *, level: Literal['trial', 'participant', 'overall'] = 'trial', curve_id: str | None = None, participant_id: str | None = None) -> pd.DataFrame
Return one auditable residual-diagnostic summary level.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.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 | |
eyetrajectoriespy.functional_mixed_effects_residual_pair_frame ¶
functional_mixed_effects_residual_pair_frame(result: FunctionalMixedEffectsResidualDiagnosticsResult, *, lag_index: int, curve_id: str | None = None, participant_id: str | None = None) -> pd.DataFrame
Expose exact within-trial residual pairs for one declared index lag.
No physical-lag bins are created. This helper is intended for auditing non-equally-spaced common grids or for analyst-declared downstream physical-lag summaries.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.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 | |
eyetrajectoriespy.compare_functional_mixed_effects_residual_diagnostics ¶
compare_functional_mixed_effects_residual_diagnostics(reference: FunctionalMixedEffectsResult, comparison: FunctionalMixedEffectsResult, *, max_lag: int, reference_label: str = 'reference', comparison_label: str = 'comparison', residual_scale: Literal['raw', 'whitened'] = 'raw') -> pd.DataFrame
Compare overall residual-dependence diagnostics for two nested analyses.
This is a descriptive sensitivity comparison. It does not rank the fits, choose a covariance structure, or perform a hypothesis test.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.py
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 | |
eyetrajectoriespy.plot_functional_mixed_effects_residual_acf ¶
plot_functional_mixed_effects_residual_acf(result: FunctionalMixedEffectsResidualDiagnosticsResult, *, level: Literal['trial', 'participant', 'overall'] = 'overall', curve_id: str | None = None, participant_id: str | None = None, ax=None)
Plot residual autocorrelation against retained physical lag.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.py
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | |
eyetrajectoriespy.plot_functional_mixed_effects_residual_variogram ¶
plot_functional_mixed_effects_residual_variogram(result: FunctionalMixedEffectsResidualDiagnosticsResult, *, level: Literal['trial', 'participant', 'overall'] = 'overall', curve_id: str | None = None, participant_id: str | None = None, ax=None)
Plot empirical residual semivariance against retained physical lag.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.py
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
eyetrajectoriespy.functional_mixed_effects_residual_reporting_text ¶
functional_mixed_effects_residual_reporting_text(result: FunctionalMixedEffectsResidualDiagnosticsResult) -> str
Return compact manuscript-oriented residual-diagnostic reporting text.
Source code in src/eyetrajectoriespy/functional_mixed_effects_diagnostics.py
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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
Covariance-structure sensitivity¶
eyetrajectoriespy.FunctionalMixedEffectsCovarianceSpecification
dataclass
¶
Declared covariance structure for sensitivity analysis.
Source code in src/eyetrajectoriespy/types.py
963 964 965 966 967 968 969 970 | |
eyetrajectoriespy.FunctionalMixedEffectsCovarianceSensitivityResult
dataclass
¶
Descriptive comparison across predeclared mixed-effects covariances.
Source code in src/eyetrajectoriespy/types.py
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | |
eyetrajectoriespy.functional_mixed_effects_covariance_sensitivity ¶
Descriptive covariance-structure sensitivity for functional mixed models.
Version 0.50 compares predeclared, already fitted covariance structures against one analyst-declared reference. It deliberately does not fit covariance combinations, rank models, select a winner, or attach likelihood-ratio p-values.
functional_mixed_effects_variance_decomposition ¶
functional_mixed_effects_variance_decomposition(fit: FunctionalMixedEffectsResult, *, model_label: str | None = None) -> pd.DataFrame
Return participant/trial/residual variance functions on the time grid.
Participant random-intercept variance, random-slope variance, and intercept/slope cross-covariance are kept separate. The function does not collapse them into a percentage or a preferred covariance decomposition.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
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 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 383 384 385 386 387 388 389 390 391 392 | |
functional_mixed_effects_covariance_sensitivity ¶
functional_mixed_effects_covariance_sensitivity(fits: Mapping[str, FunctionalMixedEffectsResult], *, reference: str, max_lag: int, specifications: Sequence[FunctionalMixedEffectsCovarianceSpecification] | None = None, failures: Mapping[str, str] | None = None, bands: Mapping[str, FunctionalMixedEffectsBandResult] | None = None) -> FunctionalMixedEffectsCovarianceSensitivityResult
Compare already fitted, predeclared covariance structures descriptively.
The routine never fits a model, ranks structures, returns a best model, performs a likelihood-ratio test, or selects a covariance family.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
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 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | |
plot_covariance_sensitivity_coefficients ¶
plot_covariance_sensitivity_coefficients(result: FunctionalMixedEffectsCovarianceSensitivityResult, *, coefficient: str, ax=None)
Plot coefficient-function differences from the declared reference.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | |
plot_covariance_sensitivity_band_widths ¶
plot_covariance_sensitivity_band_widths(result: FunctionalMixedEffectsCovarianceSensitivityResult, *, coefficient: str, ax=None)
Plot simultaneous-band width ratios against the declared reference.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | |
plot_functional_variance_decomposition ¶
plot_functional_variance_decomposition(result: FunctionalMixedEffectsResult | FunctionalMixedEffectsCovarianceSensitivityResult, *, model: str | None = None, ax=None)
Plot functional variance/cross-covariance components for one fit.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | |
functional_mixed_effects_covariance_sensitivity_reporting_text ¶
functional_mixed_effects_covariance_sensitivity_reporting_text(result: FunctionalMixedEffectsCovarianceSensitivityResult) -> str
Return manuscript-oriented wording without selecting a covariance model.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 | |
eyetrajectoriespy.functional_mixed_effects_variance_decomposition ¶
functional_mixed_effects_variance_decomposition(fit: FunctionalMixedEffectsResult, *, model_label: str | None = None) -> pd.DataFrame
Return participant/trial/residual variance functions on the time grid.
Participant random-intercept variance, random-slope variance, and intercept/slope cross-covariance are kept separate. The function does not collapse them into a percentage or a preferred covariance decomposition.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
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 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 383 384 385 386 387 388 389 390 391 392 | |
eyetrajectoriespy.plot_covariance_sensitivity_coefficients ¶
plot_covariance_sensitivity_coefficients(result: FunctionalMixedEffectsCovarianceSensitivityResult, *, coefficient: str, ax=None)
Plot coefficient-function differences from the declared reference.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | |
eyetrajectoriespy.plot_covariance_sensitivity_band_widths ¶
plot_covariance_sensitivity_band_widths(result: FunctionalMixedEffectsCovarianceSensitivityResult, *, coefficient: str, ax=None)
Plot simultaneous-band width ratios against the declared reference.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | |
eyetrajectoriespy.plot_functional_variance_decomposition ¶
plot_functional_variance_decomposition(result: FunctionalMixedEffectsResult | FunctionalMixedEffectsCovarianceSensitivityResult, *, model: str | None = None, ax=None)
Plot functional variance/cross-covariance components for one fit.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | |
eyetrajectoriespy.functional_mixed_effects_covariance_sensitivity_reporting_text ¶
functional_mixed_effects_covariance_sensitivity_reporting_text(result: FunctionalMixedEffectsCovarianceSensitivityResult) -> str
Return manuscript-oriented wording without selecting a covariance model.
Source code in src/eyetrajectoriespy/functional_mixed_effects_covariance_sensitivity.py
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 | |
Function-on-scalar regression¶
eyetrajectoriespy.FunctionOnScalarResult
dataclass
¶
Observed-grid function-on-scalar regression fit.
Source code in src/eyetrajectoriespy/types.py
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | |
eyetrajectoriespy.FunctionOnScalarBootstrapResult
dataclass
¶
Wild-bootstrap coefficient replicates for function-on-scalar regression.
Source code in src/eyetrajectoriespy/types.py
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | |
eyetrajectoriespy.FunctionOnScalarBandResult
dataclass
¶
Observed-grid simultaneous bands for function-on-scalar coefficients.
Source code in src/eyetrajectoriespy/types.py
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | |
eyetrajectoriespy.fit_function_on_scalar_regression ¶
fit_function_on_scalar_regression(trajectories: TrajectorySet, design: DataFrame, predictors: Sequence[str], *, dimensions: Sequence[str] | None = None, participant_column: str | None = None, unit: str = 'curve') -> FunctionOnScalarResult
Fit common-grid function-on-scalar OLS with explicit inference units.
The model is fitted independently at every observed time by dimension grid point using one shared scalar design matrix. No smoothing, basis expansion, coefficient regularization, categorical encoding, centering, scaling, interaction construction, or model selection is performed.
With unit='participant', repeated source curves are first averaged within participant and every declared predictor must be constant within participant. This supports participant-level between-subject regression without pseudo-replicating trials. It is not a functional mixed-effects model and deliberately refuses trial-varying predictors.
Source code in src/eyetrajectoriespy/function_on_scalar.py
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 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 383 384 385 386 387 | |
eyetrajectoriespy.bootstrap_function_on_scalar_coefficients ¶
bootstrap_function_on_scalar_coefficients(result: FunctionOnScalarResult, *, n_bootstrap: int = 1000, multiplier: str = 'rademacher', random_state: int | None = 0) -> FunctionOnScalarBootstrapResult
Wild-bootstrap function-on-scalar coefficient curves.
Source code in src/eyetrajectoriespy/function_on_scalar.py
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 | |
eyetrajectoriespy.function_on_scalar_simultaneous_bands ¶
function_on_scalar_simultaneous_bands(bootstrap: FunctionOnScalarBootstrapResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'coefficient') -> FunctionOnScalarBandResult
Calibrate observed-grid simultaneous bands for coefficient functions.
Source code in src/eyetrajectoriespy/function_on_scalar.py
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 | |
eyetrajectoriespy.function_on_scalar_coefficient_frame ¶
function_on_scalar_coefficient_frame(result: FunctionOnScalarResult, *, band: FunctionOnScalarBandResult | None = None) -> pd.DataFrame
Return coefficient functions and optional simultaneous bands in long form.
Source code in src/eyetrajectoriespy/function_on_scalar.py
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 590 591 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 | |
eyetrajectoriespy.plot_function_on_scalar_coefficients ¶
plot_function_on_scalar_coefficients(result: FunctionOnScalarResult | FunctionOnScalarBandResult, *, coefficient: str | int, dimension: str | None = None, ax=None)
Plot one function-on-scalar coefficient with an optional simultaneous band.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.function_on_scalar_reporting_text ¶
function_on_scalar_reporting_text(result: FunctionOnScalarResult, *, band: FunctionOnScalarBandResult | None = None) -> str
Generate manuscript-oriented function-on-scalar model wording.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
Generalized function-on-scalar regression¶
eyetrajectoriespy.GeneralizedFunctionOnScalarResult
dataclass
¶
Marginal generalized function-on-scalar regression fit.
Source code in src/eyetrajectoriespy/types.py
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | |
eyetrajectoriespy.GeneralizedFunctionOnScalarBootstrapResult
dataclass
¶
Whole-participant bootstrap for generalized function-on-scalar curves.
Source code in src/eyetrajectoriespy/types.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
eyetrajectoriespy.GeneralizedFunctionOnScalarBandResult
dataclass
¶
Observed-grid simultaneous bands for generalized FoSR coefficients.
Source code in src/eyetrajectoriespy/types.py
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 | |
eyetrajectoriespy.fit_generalized_function_on_scalar_regression ¶
fit_generalized_function_on_scalar_regression(trajectories: TrajectorySet, design: DataFrame, predictors: Sequence[str], *, participant_column: str, dimension: str, family: str, binomial_denominator: ndarray | Sequence[float] | None = None, exposure: ndarray | Sequence[float] | None = None, exposure_units: str | None = None, basis_size: int = 5, spline_degree: int = 3, working_correlation: str = 'independence', covariance_type: str = 'robust', maxiter: int = 100, ctol: float = 1e-08) -> GeneralizedFunctionOnScalarResult
Fit a marginal generalized function-on-scalar model by clustered GEE.
Version 0.54 supports Bernoulli/logit and Poisson/log functional outcomes, including explicit grouped-binomial denominators and the 0.53 positive Poisson exposure contract. Coefficient functions use an explicitly sized clamped B-spline basis. Participants are the independent GEE clusters; trial-varying predictors are allowed. The only working correlation in this tranche is independence, paired with the robust sandwich covariance.
No family, link, basis size, working dependence structure, smoothing penalty, categorical encoding, predictor scaling, or model is selected automatically.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
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 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 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
eyetrajectoriespy.bootstrap_generalized_function_on_scalar_coefficients ¶
bootstrap_generalized_function_on_scalar_coefficients(result: GeneralizedFunctionOnScalarResult, *, n_bootstrap: int = 1000, random_state: int | None = 0, failed_replicate_policy: str = 'raise') -> GeneralizedFunctionOnScalarBootstrapResult
Whole-participant case bootstrap for generalized FoSR coefficients.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
eyetrajectoriespy.generalized_function_on_scalar_simultaneous_bands ¶
generalized_function_on_scalar_simultaneous_bands(bootstrap: GeneralizedFunctionOnScalarBootstrapResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'coefficient') -> GeneralizedFunctionOnScalarBandResult
Calibrate observed-grid link-scale simultaneous coefficient bands.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | |
eyetrajectoriespy.generalized_function_on_scalar_coefficient_frame ¶
generalized_function_on_scalar_coefficient_frame(result: GeneralizedFunctionOnScalarResult | GeneralizedFunctionOnScalarBandResult) -> pd.DataFrame
Return one row per coefficient and observed time point.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | |
eyetrajectoriespy.generalized_function_on_scalar_exposure_frame ¶
generalized_function_on_scalar_exposure_frame(result: GeneralizedFunctionOnScalarResult) -> pd.DataFrame
Return a per-curve audit of an explicitly supplied Poisson exposure.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | |
eyetrajectoriespy.plot_generalized_function_on_scalar_coefficients ¶
plot_generalized_function_on_scalar_coefficients(result: GeneralizedFunctionOnScalarResult | GeneralizedFunctionOnScalarBandResult, *, coefficient: str, ax=None)
Plot one generalized FoSR coefficient on the declared link scale.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | |
eyetrajectoriespy.generalized_function_on_scalar_reporting_text ¶
generalized_function_on_scalar_reporting_text(result: GeneralizedFunctionOnScalarResult, *, band: GeneralizedFunctionOnScalarBandResult | None = None) -> str
Return manuscript-oriented wording for marginal generalized FoSR.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar.py
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | |
Generalized FoSR fixed-profile prediction¶
eyetrajectoriespy.GeneralizedFunctionOnScalarPredictionResult
dataclass
¶
Fixed-profile marginal predictions for generalized FoSR.
Source code in src/eyetrajectoriespy/types.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | |
eyetrajectoriespy.GeneralizedFunctionOnScalarPredictionBootstrapResult
dataclass
¶
Participant-bootstrap predictions for fixed generalized-FoSR profiles.
Source code in src/eyetrajectoriespy/types.py
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | |
eyetrajectoriespy.GeneralizedFunctionOnScalarPredictionBandResult
dataclass
¶
Observed-grid simultaneous bands for fixed marginal profiles.
Source code in src/eyetrajectoriespy/types.py
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | |
eyetrajectoriespy.GeneralizedFunctionOnScalarMeanDifferenceResult
dataclass
¶
Simultaneous response-scale mean-difference band for two profiles.
Source code in src/eyetrajectoriespy/types.py
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
eyetrajectoriespy.generalized_function_on_scalar_predict ¶
generalized_function_on_scalar_predict(result: GeneralizedFunctionOnScalarResult, profiles: DataFrame, *, profile_id_column: str = 'profile_id', exposure_profiles=None, prediction_scale: str | None = None) -> GeneralizedFunctionOnScalarPredictionResult
Predict fixed marginal response profiles under a generalized FoSR fit.
Profiles are fixed analyst-declared targets. Their predictor values are never estimated, averaged, resampled, centered, scaled, or encoded by this function. Targets outside the observed scalar predictor ranges are retained and explicitly flagged as extrapolations.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | |
eyetrajectoriespy.bootstrap_generalized_function_on_scalar_predictions ¶
bootstrap_generalized_function_on_scalar_predictions(bootstrap: GeneralizedFunctionOnScalarBootstrapResult, profiles: DataFrame, *, profile_id_column: str = 'profile_id', exposure_profiles=None, prediction_scale: str | None = None) -> GeneralizedFunctionOnScalarPredictionBootstrapResult
Project participant-bootstrap coefficient functions to fixed profiles.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
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 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 | |
eyetrajectoriespy.generalized_function_on_scalar_prediction_bands ¶
generalized_function_on_scalar_prediction_bands(bootstrap: GeneralizedFunctionOnScalarPredictionBootstrapResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'profile') -> GeneralizedFunctionOnScalarPredictionBandResult
Calibrate simultaneous fixed-profile marginal mean bands.
Calibration is performed on the linear-predictor scale. Because the logit and log inverse links are strictly monotone, transforming both endpoints produces simultaneous marginal probability/mean bands with the same bootstrap event on the observed grid.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
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 | |
eyetrajectoriespy.generalized_function_on_scalar_mean_difference_band ¶
generalized_function_on_scalar_mean_difference_band(bootstrap: GeneralizedFunctionOnScalarPredictionBootstrapResult, *, profile_a: str, profile_b: str, confidence_level: float = 0.95, contrast_scale: str | None = None) -> GeneralizedFunctionOnScalarMeanDifferenceResult
Construct one predeclared simultaneous marginal profile contrast.
Bernoulli fits support a probability difference. Poisson fits without exposure support an expected-count difference. Exposure-adjusted Poisson fits support an explicit rate difference, rate ratio, or expected-count difference when target exposure was supplied for count prediction.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
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 590 591 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | |
eyetrajectoriespy.generalized_function_on_scalar_prediction_frame ¶
generalized_function_on_scalar_prediction_frame(result: GeneralizedFunctionOnScalarPredictionResult | GeneralizedFunctionOnScalarPredictionBandResult) -> pd.DataFrame
Return one row per fixed profile and observed time point.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
eyetrajectoriespy.generalized_function_on_scalar_mean_difference_frame ¶
generalized_function_on_scalar_mean_difference_frame(result: GeneralizedFunctionOnScalarMeanDifferenceResult) -> pd.DataFrame
Return the observed-grid response-scale mean-difference band.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | |
eyetrajectoriespy.plot_generalized_function_on_scalar_predictions ¶
plot_generalized_function_on_scalar_predictions(result: GeneralizedFunctionOnScalarPredictionResult | GeneralizedFunctionOnScalarPredictionBandResult, *, ax=None)
Plot fixed-profile marginal mean functions and optional bands.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | |
eyetrajectoriespy.plot_generalized_function_on_scalar_mean_difference ¶
plot_generalized_function_on_scalar_mean_difference(result: GeneralizedFunctionOnScalarMeanDifferenceResult, *, ax=None)
Plot one predeclared response-scale profile contrast band.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | |
eyetrajectoriespy.generalized_function_on_scalar_prediction_reporting_text ¶
generalized_function_on_scalar_prediction_reporting_text(result: GeneralizedFunctionOnScalarPredictionBandResult) -> str
Return manuscript-oriented wording for fixed-profile prediction.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | |
eyetrajectoriespy.generalized_function_on_scalar_mean_difference_reporting_text ¶
generalized_function_on_scalar_mean_difference_reporting_text(result: GeneralizedFunctionOnScalarMeanDifferenceResult) -> str
Return manuscript wording for one predeclared profile contrast band.
Source code in src/eyetrajectoriespy/generalized_function_on_scalar_prediction.py
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | |
Downstream analysis¶
eyetrajectoriespy.functional_l2_distance ¶
functional_l2_distance(a: ndarray, b: ndarray, *, time: ndarray, dimension_weights: ndarray | None = None) -> float
Integrated L2 distance between two complete multivariate functions.
Source code in src/eyetrajectoriespy/analysis.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
eyetrajectoriespy.pairwise_functional_distances ¶
pairwise_functional_distances(trajectories: TrajectorySet, *, dimension_weights: ndarray | None = None) -> np.ndarray
Pairwise integrated L2 distance matrix for complete trajectories.
Source code in src/eyetrajectoriespy/analysis.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | |
eyetrajectoriespy.discrete_frechet_distance ¶
discrete_frechet_distance(a: ndarray, b: ndarray, *, dimension_weights: ndarray | None = None, return_coupling: bool = False) -> float | DiscreteFrechetResult
Compute discrete Fréchet distance between ordered point sequences.
The coupling is monotone in both sequence indices. Elapsed time is not used. No interpolation, resampling, coordinate normalization, or path simplification is performed.
With return_coupling=True, one deterministic optimal coupling is returned. Multiple optimal couplings can exist; ties prefer a diagonal predecessor, then advancing a, then advancing b.
Source code in src/eyetrajectoriespy/analysis.py
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 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 | |
eyetrajectoriespy.pairwise_discrete_frechet_distances ¶
pairwise_discrete_frechet_distances(trajectories: TrajectorySet, *, dimensions: tuple[str, ...] | list[str] | None = None, dimension_weights: ndarray | None = None) -> np.ndarray
Pairwise discrete Fréchet distances for complete trajectories.
dimensions=None uses every stored functional dimension in its current order. No time values are passed to the Fréchet recurrence.
Source code in src/eyetrajectoriespy/analysis.py
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 | |
eyetrajectoriespy.dynamic_time_warping_distance ¶
dynamic_time_warping_distance(a: ndarray, b: ndarray, *, dimension_weights: ndarray | None = None, window_radius: int | None = None, step_pattern: str = 'symmetric1', normalize: bool = False, return_path: bool = False) -> float | DynamicTimeWarpingResult
Compute DTW using explicit symmetric1 or symmetric2 step weighting.
symmetric1 preserves the 0.33 contract: every visited local distance contributes once and the resulting cumulative cost is not normalizable by a path-independent length denominator.
symmetric2 gives diagonal moves weight two and horizontal/vertical moves weight one. Its cumulative cost can be normalized by n_a + n_b. Set normalize=True to return that normalized value.
window_radius is an optional Sakoe-Chiba band in sample-index units. Recorded timestamps are not used. No interpolation, resampling, smoothing, coordinate normalization, path simplification, missing-value deletion, or automatic step-pattern/window selection is performed.
Source code in src/eyetrajectoriespy/analysis.py
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 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 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 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 | |
eyetrajectoriespy.pairwise_dynamic_time_warping_distances ¶
pairwise_dynamic_time_warping_distances(trajectories: TrajectorySet, *, dimensions: tuple[str, ...] | list[str] | None = None, dimension_weights: ndarray | None = None, window_radius: int | None = None, step_pattern: str = 'symmetric1', normalize: bool = False) -> np.ndarray
Pairwise DTW distances for complete trajectories.
The TrajectorySet time grid is not passed into the recurrence. window_radius constrains sample-index displacement, not physical time. The 0.33 symmetric1 raw-cost behavior remains the default.
Source code in src/eyetrajectoriespy/analysis.py
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 | |
eyetrajectoriespy.cluster_fpca_scores ¶
cluster_fpca_scores(fpca: FPCAResult, *, n_clusters: int, n_components: int | None = None, random_state: int = 0, n_init: int | str = 'auto') -> ClusterResult
Cluster curves using a deterministic K-means fit to retained FPCA scores.
Source code in src/eyetrajectoriespy/analysis.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
eyetrajectoriespy.fit_scalar_on_function_regression ¶
fit_scalar_on_function_regression(fpca: FPCAResult, outcome: ndarray | Series, *, n_components: int | None = None, family: str = 'gaussian', covariates: DataFrame | None = None) -> FunctionalRegressionResult
Approximate scalar-on-function regression through FPCA score predictors.
Source code in src/eyetrajectoriespy/analysis.py
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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
Plotting and reporting¶
eyetrajectoriespy.plot_planar_trajectories ¶
plot_planar_trajectories(trajectories: TrajectorySet, *, max_curves: int | None = 40, alpha: float = 0.35, invert_y: bool = True, ax=None)
Plot continuous x/y gaze paths in screen space.
Source code in src/eyetrajectoriespy/plotting.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
eyetrajectoriespy.plot_dynamic_time_warping_alignment ¶
plot_dynamic_time_warping_alignment(result: DynamicTimeWarpingResult, *, ax=None)
Plot one audited DTW alignment path in sample-index space.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.plot_fpca_component ¶
plot_fpca_component(result: FPCAResult, *, component: int = 0, dimension: str | None = None, sd_multiplier: float = 2.0, ax=None)
Plot mean ± one FPC mode for a selected functional dimension.
Source code in src/eyetrajectoriespy/plotting.py
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | |
eyetrajectoriespy.plot_warping_functions ¶
plot_warping_functions(result: RegistrationResult, *, displacement: bool = False, ax=None)
Plot estimated time warpings or displacement from identity.
Source code in src/eyetrajectoriespy/plotting.py
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | |
eyetrajectoriespy.plot_fpca_stability ¶
plot_fpca_stability(result: FPCAStabilityResult, *, ax=None)
Plot bootstrap absolute component similarities by reference FPC.
Source code in src/eyetrajectoriespy/plotting.py
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | |
eyetrajectoriespy.plot_reconstruction_curve ¶
plot_reconstruction_curve(reconstruction_summary, *, ax=None)
Plot integrated reconstruction error against retained FPC count.
Source code in src/eyetrajectoriespy/plotting.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | |
eyetrajectoriespy.dynamic_time_warping_reporting_text ¶
dynamic_time_warping_reporting_text(result: DynamicTimeWarpingResult, *, digits: int = 3) -> str
Generate compact reporting text for one audited DTW alignment.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
eyetrajectoriespy.TrajectoryDistanceSensitivityResult
dataclass
¶
Descriptive robustness diagnostics across trajectory-distance contracts.
Source code in src/eyetrajectoriespy/types.py
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
eyetrajectoriespy.trajectory_distance_sensitivity ¶
trajectory_distance_sensitivity(trajectories: TrajectorySet, specifications: Sequence[Mapping[str, Any]], *, dimensions: Sequence[str] | None = None, dimension_weights: ndarray | Sequence[float] | None = None, neighbor_k: int = 3) -> TrajectoryDistanceSensitivityResult
Compare trajectory-distance conclusions across declared specifications.
The function compares the same complete trajectories and selected dimensions under at least two explicitly declared distance contracts. It returns all raw distance matrices, global pairwise-distance rank agreement, and local nearest-neighbor overlap.
No distance matrix is standardized, rescaled, averaged into a consensus, or assigned a preferred metric. Correlation quantities are descriptive: no p-values are computed because the upper-triangle pair distances are not independent observations.
Source code in src/eyetrajectoriespy/similarity_sensitivity.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 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 | |
eyetrajectoriespy.trajectory_distance_comparison_frame ¶
trajectory_distance_comparison_frame(result: TrajectoryDistanceSensitivityResult) -> pd.DataFrame
Return one row per pair of distance specifications.
Source code in src/eyetrajectoriespy/similarity_sensitivity.py
516 517 518 519 520 521 522 523 524 525 | |
eyetrajectoriespy.trajectory_distance_neighbor_frame ¶
trajectory_distance_neighbor_frame(result: TrajectoryDistanceSensitivityResult) -> pd.DataFrame
Return per-curve local-neighborhood agreement across specifications.
Source code in src/eyetrajectoriespy/similarity_sensitivity.py
528 529 530 531 532 533 534 535 536 537 | |
eyetrajectoriespy.plot_trajectory_distance_rank_correlations ¶
plot_trajectory_distance_rank_correlations(result: TrajectoryDistanceSensitivityResult, *, ax=None)
Plot descriptive Spearman agreement among distance specifications.
Source code in src/eyetrajectoriespy/plotting.py
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 | |
eyetrajectoriespy.trajectory_distance_sensitivity_reporting_text ¶
trajectory_distance_sensitivity_reporting_text(result: TrajectoryDistanceSensitivityResult, *, digits: int = 3) -> str
Generate manuscript-oriented wording for distance-contract sensitivity.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
eyetrajectoriespy.fpca_stability_reporting_text ¶
fpca_stability_reporting_text(result: FPCAStabilityResult, *, similarity_threshold: float = 0.8, digits: int = 2) -> str
Generate compact descriptive text for bootstrap FPC stability.
Source code in src/eyetrajectoriespy/reporting.py
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 | |
eyetrajectoriespy.registration_sensitivity_reporting_text ¶
registration_sensitivity_reporting_text(result: RegistrationSensitivityResult, *, digits: int = 2) -> str
Generate descriptive text comparing FPC structure before/after registration.
Source code in src/eyetrajectoriespy/reporting.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | |
eyetrajectoriespy.summarise_fpca ¶
summarise_fpca(result: FPCAResult) -> pd.DataFrame
Return a component-level explained-variance table.
Source code in src/eyetrajectoriespy/reporting.py
446 447 448 449 450 451 452 453 | |
eyetrajectoriespy.fpca_reporting_text ¶
fpca_reporting_text(result: FPCAResult, *, digits: int = 1) -> str
Generate compact manuscript-ready descriptive text for an FPCA fit.
Source code in src/eyetrajectoriespy/reporting.py
456 457 458 459 460 461 462 463 464 465 466 | |
Optional interoperability¶
eyetrajectoriespy.to_skfda_grid ¶
to_skfda_grid(trajectories: TrajectorySet)
Convert trajectories to skfda.FDataGrid without changing values.
The optional dependency is not required for the package's core FPCA.
Source code in src/eyetrajectoriespy/backends.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
eyetrajectoriespy.to_skfda_basis ¶
to_skfda_basis(trajectories: TrajectorySet, *, dimension: str, basis: str = 'bspline', n_basis: int = 15, order: int = 4) -> BasisProjectionResult
Project one functional dimension to an explicit scikit-fda basis.
Basis projection is an approximation/smoothing decision. The selected basis family and size are returned in a provenance-preserving wrapper.
Source code in src/eyetrajectoriespy/backends.py
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 | |
eyetrajectoriespy.fit_elastic_fpca ¶
fit_elastic_fpca(trajectories: TrajectorySet, *, n_components: int = 3, rotation: bool = False, scale_curves: bool = False, lam: float = 0.0, method: str = 'DP') -> ElasticFPCAResult
Fit elastic planar-curve FPCA using fdasrsf.
Unlike ordinary grid FPCA, elastic analysis aligns curves in the
square-root velocity framework and explicitly estimates warping functions.
The function intentionally exposes rotation and scale_curves rather
than normalizing geometry silently: rotation or scale invariance is often
inappropriate for screen-based eye tracking where absolute layout matters.
Source code in src/eyetrajectoriespy/elastic.py
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
Discrete transfer entropy¶
eyetrajectoriespy.DiscreteTransferEntropyResult
dataclass
¶
Empirical plug-in transfer entropy for two discrete state sequences.
Source code in src/eyetrajectoriespy/transfer_entropy.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
eyetrajectoriespy.TransferEntropyCircularShiftTestResult
dataclass
¶
Circular-shift surrogate test for one declared discrete TE contract.
Source code in src/eyetrajectoriespy/transfer_entropy.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
eyetrajectoriespy.discrete_transfer_entropy ¶
discrete_transfer_entropy(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, *, target_history: int, source_history: int, source_lag: int) -> DiscreteTransferEntropyResult
Estimate empirical discrete transfer entropy from source to target.
The estimator is empirical plug-in conditional mutual information in bits. History lengths and source lag are required sample-index settings. Continuous observations are never binned, rounded, scaled, smoothed, or interpolated. A positive estimate is not interpreted as proof of causal influence.
Source code in src/eyetrajectoriespy/transfer_entropy.py
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 | |
eyetrajectoriespy.transfer_entropy_local_frame ¶
transfer_entropy_local_frame(result: DiscreteTransferEntropyResult) -> pd.DataFrame
Return local TE contributions and the histories used for each row.
Source code in src/eyetrajectoriespy/transfer_entropy.py
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 | |
eyetrajectoriespy.transfer_entropy_circular_shift_test ¶
transfer_entropy_circular_shift_test(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, *, target_history: int, source_history: int, source_lag: int, shifts: Sequence[int]) -> TransferEntropyCircularShiftTestResult
Compare observed TE with analyst-declared circular source shifts.
The shift set is mandatory and is never generated or optimized. The returned p-value is the plus-one upper-tail Monte Carlo value. Circular shifts require a defensible wrap-around/stationarity assumption and do not establish causality.
Source code in src/eyetrajectoriespy/transfer_entropy.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
eyetrajectoriespy.plot_transfer_entropy_circular_shift_test ¶
plot_transfer_entropy_circular_shift_test(result: TransferEntropyCircularShiftTestResult, *, ax=None, bins: int | str = 'auto')
Plot the circular-shift null distribution and observed TE.
Source code in src/eyetrajectoriespy/transfer_entropy.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
eyetrajectoriespy.transfer_entropy_reporting_text ¶
transfer_entropy_reporting_text(result: DiscreteTransferEntropyResult) -> str
Return compact manuscript-oriented text for a TE estimate.
Source code in src/eyetrajectoriespy/transfer_entropy.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
eyetrajectoriespy.transfer_entropy_circular_shift_reporting_text ¶
transfer_entropy_circular_shift_reporting_text(result: TransferEntropyCircularShiftTestResult) -> str
Return compact reporting text for a circular-shift TE test.
Source code in src/eyetrajectoriespy/transfer_entropy.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
Transfer entropy sensitivity¶
eyetrajectoriespy.TransferEntropySensitivityResult
dataclass
¶
Declared multiverse of discrete transfer-entropy specifications.
Source code in src/eyetrajectoriespy/transfer_entropy_sensitivity.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
eyetrajectoriespy.transfer_entropy_parameter_sensitivity ¶
transfer_entropy_parameter_sensitivity(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, *, target_histories: Sequence[int], source_histories: Sequence[int], source_lags: Sequence[int], shifts: Sequence[int] | None = None) -> TransferEntropySensitivityResult
Evaluate a predeclared transfer-entropy specification multiverse.
Every Cartesian-product combination of target history, source history, and source lag is evaluated. If shifts are supplied, the exact same analyst-declared circular-shift set is used for every specification.
Invalid specifications abort the analysis with the failing combination identified. No failed row is removed, no parameter is selected automatically, and the descriptive summaries are not sampling distributions or multiplicity-adjusted inference.
Source code in src/eyetrajectoriespy/transfer_entropy_sensitivity.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 | |
eyetrajectoriespy.plot_transfer_entropy_sensitivity ¶
plot_transfer_entropy_sensitivity(result: TransferEntropySensitivityResult, *, parameter: str, metric: str = 'transfer_entropy_bits', filters: Mapping[str, int] | None = None, ax=None)
Plot one explicit TE-sensitivity slice without hidden averaging.
Source code in src/eyetrajectoriespy/transfer_entropy_sensitivity.py
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 | |
eyetrajectoriespy.transfer_entropy_parameter_sensitivity_reporting_text ¶
transfer_entropy_parameter_sensitivity_reporting_text(result: TransferEntropySensitivityResult) -> str
Return manuscript-oriented wording for a TE specification multiverse.
Source code in src/eyetrajectoriespy/transfer_entropy_sensitivity.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 | |
Conditional transfer entropy¶
eyetrajectoriespy.ConditionalTransferEntropyResult
dataclass
¶
Empirical plug-in conditional transfer entropy for discrete sequences.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
eyetrajectoriespy.ConditionalTransferEntropyCircularShiftTestResult
dataclass
¶
Source-only circular-shift test for one declared conditional-TE contract.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
51 52 53 54 55 56 57 58 59 60 61 62 | |
eyetrajectoriespy.conditional_transfer_entropy ¶
Discrete conditional transfer entropy with explicit scientific contracts.
ConditionalTransferEntropyResult
dataclass
¶
Empirical plug-in conditional transfer entropy for discrete sequences.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
ConditionalTransferEntropyCircularShiftTestResult
dataclass
¶
Source-only circular-shift test for one declared conditional-TE contract.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
51 52 53 54 55 56 57 58 59 60 61 62 | |
conditional_transfer_entropy ¶
conditional_transfer_entropy(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, condition: Sequence[int] | ndarray, *, target_history: int, source_history: int, condition_history: int, source_lag: int, condition_lag: int) -> ConditionalTransferEntropyResult
Estimate empirical discrete conditional transfer entropy in bits.
The estimand is the conditional mutual information between the declared source history and the next target state, conditional on both the target history and the declared conditioning-process history.
Input state sequences must be analyst-supplied integer codes. No automatic discretization, smoothing, scaling, interpolation, history selection, lag selection, support filtering, or causal interpretation is introduced.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 292 293 294 295 296 297 298 299 300 301 302 303 | |
conditional_transfer_entropy_local_frame ¶
conditional_transfer_entropy_local_frame(result: ConditionalTransferEntropyResult) -> pd.DataFrame
Return local conditional-TE contributions and exact histories.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.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 | |
conditional_transfer_entropy_circular_shift_test ¶
conditional_transfer_entropy_circular_shift_test(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, condition: Sequence[int] | ndarray, *, target_history: int, source_history: int, condition_history: int, source_lag: int, condition_lag: int, shifts: Sequence[int]) -> ConditionalTransferEntropyCircularShiftTestResult
Test conditional TE using analyst-declared source-only circular shifts.
Only the source sequence is shifted. Target and conditioning sequences stay fixed. The returned p-value is the plus-one upper-tail Monte Carlo value. This is a predictive-information null under a declared circular-shift construction, not a causal-identification test.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 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 | |
plot_conditional_transfer_entropy_circular_shift_test ¶
plot_conditional_transfer_entropy_circular_shift_test(result: ConditionalTransferEntropyCircularShiftTestResult, *, ax=None, bins: int | str = 'auto')
Plot the source-shift null distribution and observed conditional TE.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
conditional_transfer_entropy_reporting_text ¶
conditional_transfer_entropy_reporting_text(result: ConditionalTransferEntropyResult) -> str
Return compact manuscript-oriented text for conditional TE.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
conditional_transfer_entropy_circular_shift_reporting_text ¶
conditional_transfer_entropy_circular_shift_reporting_text(result: ConditionalTransferEntropyCircularShiftTestResult) -> str
Return compact reporting text for a source-shift conditional-TE test.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
eyetrajectoriespy.conditional_transfer_entropy_local_frame ¶
conditional_transfer_entropy_local_frame(result: ConditionalTransferEntropyResult) -> pd.DataFrame
Return local conditional-TE contributions and exact histories.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.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 | |
eyetrajectoriespy.conditional_transfer_entropy_circular_shift_test ¶
conditional_transfer_entropy_circular_shift_test(source: Sequence[int] | ndarray, target: Sequence[int] | ndarray, condition: Sequence[int] | ndarray, *, target_history: int, source_history: int, condition_history: int, source_lag: int, condition_lag: int, shifts: Sequence[int]) -> ConditionalTransferEntropyCircularShiftTestResult
Test conditional TE using analyst-declared source-only circular shifts.
Only the source sequence is shifted. Target and conditioning sequences stay fixed. The returned p-value is the plus-one upper-tail Monte Carlo value. This is a predictive-information null under a declared circular-shift construction, not a causal-identification test.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 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 | |
eyetrajectoriespy.plot_conditional_transfer_entropy_circular_shift_test ¶
plot_conditional_transfer_entropy_circular_shift_test(result: ConditionalTransferEntropyCircularShiftTestResult, *, ax=None, bins: int | str = 'auto')
Plot the source-shift null distribution and observed conditional TE.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
eyetrajectoriespy.conditional_transfer_entropy_reporting_text ¶
conditional_transfer_entropy_reporting_text(result: ConditionalTransferEntropyResult) -> str
Return compact manuscript-oriented text for conditional TE.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
eyetrajectoriespy.conditional_transfer_entropy_circular_shift_reporting_text ¶
conditional_transfer_entropy_circular_shift_reporting_text(result: ConditionalTransferEntropyCircularShiftTestResult) -> str
Return compact reporting text for a source-shift conditional-TE test.
Source code in src/eyetrajectoriespy/conditional_transfer_entropy.py
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 | |
Functional mixed-effects simultaneous inference¶
eyetrajectoriespy.FunctionalMixedEffectsBootstrapResult
dataclass
¶
Participant-cluster bootstrap for functional mixed-effects coefficients.
Source code in src/eyetrajectoriespy/types.py
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 | |
eyetrajectoriespy.FunctionalMixedEffectsBandResult
dataclass
¶
Observed-grid simultaneous bands for mixed-effects coefficient functions.
Source code in src/eyetrajectoriespy/types.py
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | |
eyetrajectoriespy.bootstrap_functional_mixed_effects_coefficients ¶
bootstrap_functional_mixed_effects_coefficients(result: FunctionalMixedEffectsResult, *, n_bootstrap: int = 1000, random_state: int | None = 0) -> FunctionalMixedEffectsBootstrapResult
Bootstrap mixed-effects coefficient functions by participant clusters.
Whole participant trial bundles are sampled with replacement. For every resample, the fixed B-spline coefficients are re-estimated by GLS while the reference random-effect covariance and residual variance are held fixed.
This targets participant-level sampling variability in the fixed coefficient functions conditional on the fitted covariance model and declared bases. It is not a full variance-component-refitting bootstrap.
Source code in src/eyetrajectoriespy/functional_mixed_effects_inference.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 | |
eyetrajectoriespy.functional_mixed_effects_simultaneous_bands ¶
functional_mixed_effects_simultaneous_bands(bootstrap: FunctionalMixedEffectsBootstrapResult | FunctionalMixedEffectsFullRefitBootstrapResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'coefficient') -> FunctionalMixedEffectsBandResult
Calibrate observed-grid simultaneous mixed-effects coefficient bands.
Source code in src/eyetrajectoriespy/functional_mixed_effects_inference.py
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 | |
Random functional slope inspection¶
eyetrajectoriespy.functional_random_effect_frame ¶
functional_random_effect_frame(result: FunctionalMixedEffectsResult, *, effect: str = 'intercept') -> pd.DataFrame
Return participant BLUP functional random effects in long form.
Source code in src/eyetrajectoriespy/functional_mixed_effects.py
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | |
eyetrajectoriespy.plot_functional_random_effects ¶
plot_functional_random_effects(result: FunctionalMixedEffectsResult, *, effect: str = 'intercept', max_participants: int | None = None, alpha: float = 0.35, ax=None)
Plot participant BLUP random-intercept or random-slope functions.
Source code in src/eyetrajectoriespy/plotting.py
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 316 | |
Trial functional random-effect inspection¶
eyetrajectoriespy.functional_trial_random_effect_frame ¶
functional_trial_random_effect_frame(result: FunctionalMixedEffectsResult) -> pd.DataFrame
Return one row per nested trial and time point for trial BLUPs.
Source code in src/eyetrajectoriespy/functional_mixed_effects_nested.py
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | |
eyetrajectoriespy.plot_functional_trial_random_effects ¶
plot_functional_trial_random_effects(result: FunctionalMixedEffectsResult, *, participant_id: str | None = None, max_trials: int = 12, ax=None)
Plot retained trial-level functional BLUPs without hidden averaging.
Source code in src/eyetrajectoriespy/functional_mixed_effects_nested.py
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | |
Functional mixed-effects full-refit bootstrap¶
eyetrajectoriespy.FunctionalMixedEffectsFullRefitBootstrapResult
dataclass
¶
Whole-participant bootstrap with complete mixed-model refitting.
Source code in src/eyetrajectoriespy/types.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | |
eyetrajectoriespy.bootstrap_functional_mixed_effects_full_refit ¶
bootstrap_functional_mixed_effects_full_refit(result: FunctionalMixedEffectsResult, *, n_bootstrap: int = 1000, random_state: int | None = 0) -> FunctionalMixedEffectsFullRefitBootstrapResult
Bootstrap whole participants and refit all mixed-model parameters.
Each sampled participant occurrence receives a distinct bootstrap group identity, even when the same source participant is drawn multiple times. Every bootstrap replicate refits fixed coefficients, the random-effect covariance, and residual variance under the original declared model specification.
Basis sizes, knots implied by the unchanged common grid, preprocessing, response dimension, predictors, random-slope structure, optimizer, REML/ML choice, and convergence policy are held fixed.
Source code in src/eyetrajectoriespy/functional_mixed_effects_full_refit.py
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 292 293 294 295 296 297 298 299 300 301 302 303 304 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 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 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 590 591 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 | |
eyetrajectoriespy.functional_mixed_effects_full_refit_audit_frame ¶
functional_mixed_effects_full_refit_audit_frame(bootstrap: FunctionalMixedEffectsFullRefitBootstrapResult) -> pd.DataFrame
Return one row per bootstrap participant draw with source/group IDs.
Source code in src/eyetrajectoriespy/functional_mixed_effects_full_refit.py
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 656 657 658 | |
eyetrajectoriespy.functional_mixed_effects_full_refit_trial_audit_frame ¶
functional_mixed_effects_full_refit_trial_audit_frame(bootstrap: FunctionalMixedEffectsFullRefitBootstrapResult) -> pd.DataFrame
Return source/bootstrap participant and trial identities for every draw.
Source code in src/eyetrajectoriespy/functional_mixed_effects_full_refit.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | |
eyetrajectoriespy.functional_mixed_effects_variance_bootstrap_frame ¶
functional_mixed_effects_variance_bootstrap_frame(bootstrap: FunctionalMixedEffectsFullRefitBootstrapResult) -> pd.DataFrame
Summarize refitted variance-component diagnostics by replicate.
Source code in src/eyetrajectoriespy/functional_mixed_effects_full_refit.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | |
eyetrajectoriespy.compare_functional_mixed_effects_bootstraps ¶
compare_functional_mixed_effects_bootstraps(fixed_covariance_bootstrap: FunctionalMixedEffectsBootstrapResult, full_refit_bootstrap: FunctionalMixedEffectsFullRefitBootstrapResult, *, confidence_level: float = 0.95, simultaneous_scope: str = 'coefficient') -> pd.DataFrame
Compare simultaneous band widths from conditional and full-refit bootstraps.
Source code in src/eyetrajectoriespy/functional_mixed_effects_full_refit.py
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | |
eyetrajectoriespy.plot_functional_mixed_effects_bootstrap_comparison ¶
plot_functional_mixed_effects_bootstrap_comparison(comparison: DataFrame, *, coefficient: str, ax=None)
Plot full-refit/fixed-covariance simultaneous-band width ratios.
Source code in src/eyetrajectoriespy/plotting.py
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 | |