Dubt on gprnd function working dimension

조회 수: 2 (최근 30일)
Barbab
Barbab 2021년 9월 8일
답변: Sameer 2024년 4월 26일
I want to produce random generalized pareto numbers with the function:
R = gprnd(K,sigma,theta,[m,n,...])
My question is:
This function works in row dimension or in column dimension? For example if I type:
nPeriods = 240; % number of time periods
nVariables = 20; % number of firms/stocks etc... I want to generate from the pareto distribution
nSimul = 10; % number of scenarios
R = gprnd(1,1000,0,[nPeriods,nVariables,nSimul]);
Every row has a tail index (shape) parameter k = 1 and a scale parameter sigma = 1000 or every column?
Thank you.

답변 (1개)

Sameer
Sameer 2024년 4월 26일
Hi Barbab
The gprnd(K, sigma, theta, [m,n,...]) function is designed to generate random numbers following the generalized Pareto distribution, characterized by a shape parameter K, a scale parameter sigma, and a threshold parameter theta. The dimensions of the output array R are defined by [m,n,...], which sets the shape of the resulting array.
Specifying the dimensions of the output array with [m,n,...] does not imply a preference for either row or column orientation in terms of how the parameters K, sigma, and theta are distributed across dimensions. Instead, these parameters are uniformly applied across the entire array. Consequently, each element within the array R represents a sample from the generalized Pareto distribution, adhering to the specified parameters, irrespective of its position within the array, whether it be within rows, columns, or any higher-dimensional segments.
Consider the following example:
nPeriods = 240; % Number of time periods
nVariables = 20; % Number of firms/stocks etc.
nSimul = 10; % Number of scenarios
R = gprnd(1,1000,0,[nPeriods,nVariables,nSimul]);
In this scenario, a 3-dimensional array R of size 240 x 20 x 10 is created, where:
240 signifies the number of time periods,
20 denotes the number of firms/stocks,
10 indicates the number of scenarios.
Each element across this 3D array is generated from the generalized Pareto distribution with a shape parameter K = 1, a scale parameter sigma = 1000, and a threshold parameter theta = 0. This uniform application of parameters transcends all dimensions, emphasizing that the distribution's parameters are not exclusive to rows or columns but are instead uniformly applied to each element within the array, regardless of its dimensional position.
Please refer to the below link for more information:
I hope this helps!
Sameer

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by