Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create a unittest with transition matrix estimated with another package/library/tool #1

Open
ulf1 opened this issue Oct 5, 2018 · 1 comment

Comments

@ulf1
Copy link
Member

ulf1 commented Oct 5, 2018

No description provided.

@ulf1 ulf1 self-assigned this Oct 23, 2018
@ulf1
Copy link
Member Author

ulf1 commented Sep 26, 2019

Matlab script

clear; clc;

% read data
filename = '/Users/uh/Google Drive/pkgdev/panelctmc/data/demo1.csv';
ds = datastore(filename);
t = read(ds);

% remove notches
for i=1:size(t, 1), t{i,3} = erase(t{i,3}, '-'); end
for i=1:size(t, 1), t{i,3} = erase(t{i,3}, '+'); end
t.rating(strcmp(t.rating, 'DDD')) = {'D'};
t.rating(strcmp(t.rating, 'DD')) = {'D'};
t.rating(strcmp(t.rating, 'RD')) = {'D'};
t.rating(strcmp(t.rating, 'CC')) = {'CCC'};
t.rating(strcmp(t.rating, 'C')) = {'CCC'};

t.rating(strcmp(t.rating, '')) = {'NR'};
t.rating(strcmp(t.rating, 'withdrawn')) = {'NR'};

labels = {'AAA', 'AA', 'A', 'BBB','BB', 'B', 'CCC', 'D', 'NR'};

% preprocessing
t2 = transprobprep(t, 'labels', labels);

% estimation
mat = transprob(t2, 'labels', labels);

disp(mat);

result

   98.7357    1.2337    0.0299    0.0007    0.0000    0.0000    0.0000    0.0000    0.0000
    3.4067   91.9365    4.4970    0.1562    0.0033    0.0003    0.0000    0.0000    0.0000
    0.0422    2.2987   91.1374    6.3043    0.1991    0.0177    0.0003    0.0000    0.0004
    0.0008    0.0679    5.3621   88.4040    5.5761    0.5585    0.0113    0.0011    0.0181
    0.0000    0.0020    0.2393    7.8740   85.4902    5.8209    0.1315    0.0134    0.4287
    0.0000    0.0000    0.0070    0.3459    7.5376   85.3892    3.5604    0.5429    2.6168
    0.0000    0.0000    0.0004    0.0291    0.9637   22.1453   52.4722   17.1941    7.1952
    0.0000    0.0000    0.0009    0.0599    1.8909   39.6700    5.9405   51.5102    0.9276
    0.0000    0.0000    0.0001    0.0042    0.1386    3.1987    0.0710    0.0072   96.5804

@ulf1 ulf1 removed their assignment Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant