Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Loading
Lesson 18 of 22
Advanced Topic – Optional. Study threshold regimes, neural forecasts, event durations, and ordered category probabilities.
Advanced Topic – Optional
This chapter extends the core pathway. Complete Chapters 1–14 first, then use this material when your question and data justify the added model complexity.
Motivation
Economic behaviour may change by regime or arrive as durations and ordered categories rather than continuous outcomes.
Why this matters
Study threshold regimes, neural forecasts, event durations, and ordered category probabilities.
Packages and data
Base-R simulations; tsDyn, nnet, ordinal, and duration packages are optional.
Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Explanation 2
Book-only outputs are labelled when the separate source dataset or advanced package was not supplied.
Explanation 3
R code, paths, function names, and formulas remain left-to-right in every locale.
Terminology
Abrupt regime-specific dynamics separated by a threshold.
Different slopes below/above zero
Positive duration with a conditional mean recursion.
Time between transactions
Latent continuous index separated by cutpoints.
Calculate category probabilities
Notation and formulas
P(low)=Phi(k1-x beta); P(middle)=Phi(k2-x beta)-Phi(k1-x beta); P(high)=1-Phi(k2-x beta)
Ordered category effects vary with predictor value and category; a coefficient is not a constant probability change.
Worked example
Scenario
How does probability move among low, middle, and high categories as a predictor rises?
R check
x <- c(-1,0,1); beta <- 1.2; k <- c(-.5,.7)
low <- pnorm(k[1]-beta*x)
middle <- pnorm(k[2]-beta*x)-low
high <- 1-pnorm(k[2]-beta*x)
p <- cbind(low,middle,high)
print(p)
print(rowSums(p))The coefficient shifts a latent index, so probability effects are nonlinear and category-specific. Limitation: Latent normal errors and fixed cutpoints are assumptions; time-ordered validation remains necessary.
Visual
Probability mass shifts across ordered categories as x increases.
R connection
Run the self-contained starter code in the protected STATLAB R runner. The code prints an auditable result and avoids network or unrestricted file access.
Live R Lab
Run a self-contained example, verify its output, and explain one limitation for nonlinear dynamics and discrete outcomes.
Ready to run
Common mistake
Do not randomly split lagged or transaction data; neighbouring observations leak information.
STATLAB Tip
Plot response surfaces, regime rules, or category probabilities to make nonlinear implications reviewable.
Guided practice
Scenario
Change a TAR threshold from zero to the sample median and compare regime counts and holdout error.
Compare your result with the definition, units, and model assumptions—not only with a target number.
Exercises
Complete these without looking at the selected solutions. More than one defensible program may exist.
Explanation 1
Simulate a logistic smooth transition.
Explanation 2
Write a positive ACD recursion.
Explanation 3
Calculate probabilities at -1, 0, 1.
Selected solutions
These are compact solution routes. Confirm dimensions, units, and any changed modelling choices.
Explanation 1
w <- 1/(1+exp(-gamma*(q-c)))
Explanation 2
Use positive omega/coefficients and positive innovations.
Explanation 3
Evaluate pnorm differences and verify every row sums to one.
Chapter summary
Study threshold regimes, neural forecasts, event durations, and ordered category probabilities.
Explanation 1
TAR switches abruptly.
Explanation 2
Neural models require regularization and time-aware validation.
Explanation 3
ACD models positive durations.
Explanation 4
Ordered models should be explained through probabilities.
Terminology
threshold rule
Use in Nonlinear Dynamics and Discrete Outcomes.
TAR
Use in Nonlinear Dynamics and Discrete Outcomes.
neural network
Use in Nonlinear Dynamics and Discrete Outcomes.
category probabilities
Use in Nonlinear Dynamics and Discrete Outcomes.
References and provenance
Safavi (2026), Chapter 18. Student notes: Mohammad Safavi, Ph.D., STATLAB Academy, Version 1.0.
Resource
The authoritative 125-page English PDF accompanies this native lesson.
DownloadReflection
Name the assumption, evidence you would seek, and how the recommendation might change.
Exit check
Reach 70% to complete the chapter. Explanations appear after submission.
Checkpoint
Question 1 of 2. Answered 0/2. Passing score: 70%.