ttdata
Description
ttdata
evaluates the transition function for
observations of the threshold variable. To plot transition functions of threshold transitions,
use ttplot
.
Examples
Evaluate Transition Function
Create logistic threshold transitions at levels 0 and 5.
t = [0 5];
tt = threshold(t,Type="logistic");
tt
is a threshold
object. By default, the rate of each logistic transition function is 1
.
Evaluate the transition function at a sequence of transition variable data from -10 to 10.
z = -10:0.01:10; F = ttdata(tt,z); size(F)
ans = 1×2
2001 2
F
is a 2001-by-2 vector of transition function data. Each column is the transition function data for the corresponding threshold in tt.Levels
.
Plot Transition Functions at Respective Levels
To facilitate comparisons among transition rates, the Type="graph"
option of ttplot
graphs all transition functions at the same level. This example shows how to graph transition functions each at their respective level.
Create normal threshold transitions at levels 0 and 5 with rates 0.5 and 1.5, respectively.
tt = threshold([0 5],Type="normal",Rates=[0.5 1.5]);
Evaluate the transition functions at their respective level (the default), and then evaluate them each relative to level 0. Specify a sequence of transition variable data from -10 to 10.
z = -10:0.01:10; n = numel(z); T0 = ttdata(tt,z); T1 = ttdata(tt,z,UseZeroLevels=true);
T0
is an n
-by-1 vector of raw transition function data evaluated at the grid of transition variable data. T1
is an n
-by-1 vector of transition function data translated to be centered at level 0.
Plot both sets of transition functions separately.
% Raw transition functions figure plot(z,T0,LineWidth=2) xline(tt.Levels,'--') grid on xlabel("Level") legend(["Level 0, Rate 0.5" "Level 5, Rate 1.5"],Location="northwest")
% Shifted transition functions figure plot(z,T1,LineWidth=2) grid on xlabel("Distance from Level") legend(["Level 0, Rate 0.5" "Level 5, Rate 1.5"],Location="northwest")
Input Arguments
tt
— Threshold transitions
threshold
object
Threshold transitions, with NumStates
states, specified as a threshold
object. tt
must be fully specified (no NaN
entries).
z
— Threshold variable data
numeric vector
Threshold variable data, specified as a numeric vector.
Data Types: double
tf
— Flag indicating whether to compute data with all levels set to zero
false
(default) | true
Flag indicating whether to compute data with all levels set to 0, specified as a value in this table:
Value | Description |
---|---|
true | Computes transformation function data with all levels set to 0. This setting is useful for comparing transition rates. |
false | Computes raw transformation function data. |
Example: UseZeroLevels=true
Data Types: logical
Output Arguments
T
— Transition function data
numeric matrix
Transition function data
F(z
,tt.Levels
,tt.Rates
),
returned as a numeric matrix. F is specified by
tt.TransitionFunctionData
.
Data in T
gives transition function values relative to each
level in tt.Levels
. The number of rows of T
is
equal to the length of z
and the number of columns is equal to the
number of levels. For details, see threshold
.
Version History
Introduced in R2021b
See Also
Objects
Functions
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)