time | Calls | line |
---|
| | 32 | function [ar_z, mt_Pi] = mytauchen_z(varargin)
|
| | 33 |
|
| | 34 | %% Function default parameters setting
|
| | 35 | close all;
|
| | 36 | profile off;
|
| | 37 | profile on;
|
| | 38 |
|
< 0.001 | 1 | 39 | if ~isempty(varargin)
|
| | 40 |
|
< 0.001 | 1 | 41 | [fl_mu_z, fl_rho_z, fl_sig_z, it_zgridno, fl_lambda_z] = varargin{:}
|
< 0.001 | 1 | 42 | bl_display_param = false;
|
| | 43 |
|
| | 44 | else
|
| | 45 | fl_mu_z = 0;
|
| | 46 | fl_rho_z = 0.9;
|
| | 47 | fl_sig_z = 0.2;
|
| | 48 | it_zgridno = 10;
|
| | 49 | fl_lambda_z = 3;
|
| | 50 | bl_display_param = true;
|
| | 51 |
|
< 0.001 | 1 | 52 | end
|
| | 53 |
|
< 0.001 | 1 | 54 | ar_z = zeros(it_zgridno,1);
|
< 0.001 | 1 | 55 | mt_Pi = zeros(it_zgridno,it_zgridno);
|
< 0.001 | 1 | 56 | ar_z(1) = fl_mu_z/(1-fl_rho_z) - fl_lambda_z*sqrt(fl_sig_z^2/(1-fl_rho_z^2));
|
< 0.001 | 1 | 57 | ar_z(it_zgridno) = fl_mu_z/(1-fl_rho_z) + fl_lambda_z*sqrt(fl_sig_z^2/(1-fl_rho_z^2));
|
< 0.001 | 1 | 58 | step = (ar_z(it_zgridno)-ar_z(1))/(it_zgridno-1);
|
| | 59 |
|
| | 60 | %% Constructing entrepreneurial productivity array
|
| | 61 |
|
< 0.001 | 1 | 62 | for i=2:(it_zgridno-1)
|
< 0.001 | 4 | 63 | ar_z(i) = ar_z(i-1) + step;
|
< 0.001 | 4 | 64 | end
|
| | 65 |
|
| | 66 | %% Constructing transition matrix
|
| | 67 |
|
< 0.001 | 1 | 68 | for j = 1:it_zgridno
|
< 0.001 | 6 | 69 | for k = 1:it_zgridno
|
< 0.001 | 36 | 70 | if k == 1
|
< 0.001 | 6 | 71 | mt_Pi(j,k) = cdf_normal((ar_z(1) - fl_mu_z - fl_rho_z*ar_z(j) + step/2) / fl_sig_z);
|
< 0.001 | 30 | 72 | elseif k == it_zgridno
|
< 0.001 | 6 | 73 | mt_Pi(j,k) = 1 - cdf_normal((ar_z(it_zgridno) - fl_mu_z - fl_rho_z*ar_z(j) - step/2) / fl_sig_z);
|
< 0.001 | 24 | 74 | else
|
0.001 | 24 | 75 | mt_Pi(j,k) = cdf_normal((ar_z(k) - fl_mu_z - fl_rho_z*ar_z(j) + step/2) / fl_sig_z) - ...
|
| 24 | 76 | cdf_normal((ar_z(k) - fl_mu_z - fl_rho_z*ar_z(j) - step/2) / fl_sig_z);
|
< 0.001 | 30 | 77 | end
|
< 0.001 | 36 | 78 | end
|
< 0.001 | 6 | 79 | end
|
| | 80 |
|
| | 81 | %% Displaying entreprenurial productivity array and transition matrix
|
| | 82 |
|
< 0.001 | 1 | 83 | if (bl_display_param == true)
|
| | 84 | fprintf (2, 'log entrepreneurial Productivity array \n');
|
| | 85 | disp ('----------------------------------');
|
| | 86 | disp (ar_z');
|
| | 87 | fprintf (2, 'Transition Matrix \n');
|
| | 88 | disp ('------------------');
|
| | 89 | disp (mt_Pi);
|
| | 90 | end
|
0.004 | 1 | 91 | profile off;
|
| | 92 | profile viewer;
|
| | 93 | st_file_name = ['/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Profile/mytauchen_z_profile'];
|
| | 94 | profsave(profile('info'), st_file_name);
|
Other subfunctions in this file are not included in this listing.