Code covered by the BSD License  

Highlights from
MGraph

from MGraph by junbai wang
Probabilistic graphical models for reconstruction of genetic regulatory networks using DNA microarra

test_samplesLogline.m
%test data 1
%P/336,Graphical models in applied .........
% Book is wrong marked , I am Correct!!
clear all
close all
testdata=[18 15 6 34 10 2; 15 13 9 28 4 6; ...
        5 3 1 56 56 35; 1 1 1 12 21 8; ...
        17 10 15 29 3 7 ; 34 17 19 44 13 16;...
        2 0 3 23 52 49 ; 3 2 0 9 31 51; ...
        30 23 21 22 13 11; 25 19 40 25 16 12; ...
        8 5 1 54 191 102; 4 2 2 19 76 61]
xi=1:2:12; %unuse condition e
xj=2:2:12;
testdata=testdata(xi,:)+testdata(xj,:);
%numoftype_ineachGp=[3,2,2,2,3]
%orderof_Gp=[4,3,5,2,1]
numoftype_ineachGp=[3,2,2,3]
orderof_Gp=[4,3,2,1]
cutoff_P=0.05;
columnStart=3;
selected_model=MGraph_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
%cellLabels={'work','tenure','apartment','Age'};
cellLabels={'D','C','B','A'};
MGraph_model2Graph(selected_model,orderof_Gp,cellLabels)


%test data 2
%P/336,Graphical models in applied .........
% Book is wrong marked , I am Correct!!
clear all
close all
testdata=[18 15 6 34 10 2; 15 13 9 28 4 6; ...
        5 3 1 56 56 35; 1 1 1 12 21 8; ...
        17 10 15 29 3 7 ; 34 17 19 44 13 16;...
        2 0 3 23 52 49 ; 3 2 0 9 31 51; ...
        30 23 21 22 13 11; 25 19 40 25 16 12; ...
        8 5 1 54 191 102; 4 2 2 19 76 61]
%xi=1:2:12; %unuse condition e
%xj=2:2:12;
%testdata=testdata(xi,:)+testdata(xj,:);
numoftype_ineachGp=[3,2,2,2,3]
orderof_Gp=[4,3,5,2,1]
%numoftype_ineachGp=[3,2,2,3]
%orderof_Gp=[4,3,2,1]
cutoff_P=0.05;
columnStart=4;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'D','C','E','B','A'};
model2Graph(selected_model,orderof_Gp,cellLabels)

%test data 3
%P/32,Introduction to Graphical Modelling
% Not correct!! the inputdata in the bookis wrong [94 299] should be 131 ,244
%test university adminiation
%
clear all
close all
testdata=[512 313; 89 19;353 207;17 8;120 205; 202 391; 138 279; 131 244; 53 138; 94 299; 22 351; 24 317]
%xi=1:2:12; %unuse condition e
%xj=2:2:12;
%testdata=testdata(xi,:)+testdata(xj,:);
numoftype_ineachGp=[6,2,2]
orderof_Gp=[1,2,3]
cutoff_P=0.05;
columnStart=3;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B','C'};
model2Graph(selected_model,orderof_Gp,cellLabels)

%test data 4
%P/32,Introduction to Graphical Modelling
% Not correct!! the inputdata in the bookis wrong [94 299] should be 131 ,244
testdata=[512 313; 89 19] %;353 207;17 8;120 205; 202 391; 138 279; 131 244; 53 138; 94 299; 22 351; 24 317]
%Department 1
numoftype_ineachGp=[2,2]
orderof_Gp=[1,2]
cutoff_P=0.05;
columnStart=2;
test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)

testdata=[353 207;17 8] %;120 205; 202 391; 138 279; 131 244; 53 138; 94 299; 22 351; 24 317]
%Department 2
numoftype_ineachGp=[2,2]
orderof_Gp=[1,2]
cutoff_P=0.05;
columnStart=2;
test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)


%test income job satis
clear all
close all
testdata=[20 24  80 82;22 38 104 125;13 28 81 113;7 18 54 92 ];
numoftype_ineachGp=[4,4]
orderof_Gp=[1,2]
cutoff_P=0.05;
columnStart=2;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B'};
model2Graph(selected_model,orderof_Gp,cellLabels)

%test class room behaviour
clear all
close all
testdata=[16 1 7 1 15 3 34 8 5 1 3 3]
numoftype_ineachGp=[3,2,2]
orderof_Gp=[2 1 3]
cutoff_P=0.05;
columnStart=1;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'B','A','C'};
model2Graph(selected_model,orderof_Gp,cellLabels)



%test chromsomosmemap this one failed
testdata=[2   1   1   1   1   1;...   
1   2   2   2   1   2   ;...
1   2   1   2   1   1   ;...
2   1   2   1   1   2   ;...
1   2   1   2   1   2   ;...
1   2   2   2   2   2   ;...
1   2   2   2   2   2   ;...
2   1   2   1   2   2   ;...
2   1   1   1   1   1   ;...
2   1   1   1   1   1   ;...
1   2   1   2   1   1   ;...
1   2   2   2   2   2   ;...
1   2   1   1   1   1   ;...
2   1   2   1   1   2   ;...
1   1   1   2   1   1   ;...
1   2   2   2   2   2   ;...
2   1   1   1   1   1   ;...
2   1   1   1   1   1   ;...
1   1   1   2   1   1   ;...
2   1   1   1   1   1   ;...
2   1   2   2   2   2   ;...
2   1   1   1   1   1   ;...
1   2   2   2   2   2   ;...
1   2   1   2   1   1   ;...
1   2   2   2   2   2   ;...
1   2   1   2   2   1   ;...
1   2   1   2   2   1   ;...
1   2   2   2   2   2   ;...
2   1   1   1   1   1   ;...
1   2   2   2   2   2   ;...
2   1   1   2   1   1   ;...
1   2   2   2   2   2   ;...
1   2   1   2   2   1   ;...
2   1   2   1   2   2   ;...
2   1   1   1   1   2   ;...
2   1   2   1   2   1   ;...
2   1   1   1   1   1   ;...
1   2   1   2   2   1   ;...
1   2   2   2   1   1   ;...
1   2   1   2   1   1   ;...
1   2   1   2   1   1   ;...
2   1   1   1   1   1   ;...
1   2   1   1   2   1   ;...
1   2   1   2   1   1   ;...
1   1   2   2   1   2   ;...
2   1   2   1   2   2   ;...
2   1   2   1   2   2   ;...
2   1   1   1   1   1   ;...
1   2   2   2   1   2   ;...
1   1   1   2   2   1   ;...
2   1   1   1   2   1   ;...
1   2   2   2   1   2   ;...
2   1   2   1   1   1   ;...
2   1   1   1   1   1   ;...
2   1   1   1   2   1   ;...
1   2   2   1   2   2   ;...
1   2   2   1   2   2   ;...
1   2   2   2   2   2   ;...
1   2   2   2   2   2   ;...
2   1   1   1   1   1   ;...
1   1   1   2   1   1   ;...
2   1   2   1   1   2   ;...
2   1   1   1   2   1   ;...
2   1   1   1   1   1   ;...
2   1   1   1   2   1   ;...
2   1   1   1   1   1   ;...
1   1   2   1   1   2   ;...
2   1   1   1   1   1   ;...
1   2   1   2   1   1   ;...
2   1   2   1   1   2 ];
numoftype_ineachGp=[2,2,2,2,2,2]
orderof_Gp=[1,2,3,4,5,6]
cutoff_P=0.05;
columnStart=4;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
%cellLabels={'B','A','C'};
%model2Graph(selected_model,orderof_Gp,cellLabels)


%test analgesic trial degree freedrom was wrong
%when contain zero the df have some trabel
%it may a bug at here the last two variable are differ with MIM, Nov14.2002
%I mis-labeled the samples Nov.18.2002
clear all
close all
testdata=[3 20 5 11 14 8 3 14 12 6 13 5 12 12 0 11 10 0 3 9 4 6 9 3 ];
numoftype_ineachGp=[2,2,2,3]
orderof_Gp=[1,2,4,3]
cutoff_P=0.05;
columnStart=1;
selected_model=MGraph_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B','T','R'};
MGraph_model2Graph(selected_model,orderof_Gp,cellLabels)


%
%test college plan 
clear all
close all
testdata=[4 2 8 4 13 27 47 39 349 232 166 48 64 84 91 57 ;...
9 7 6 5 33 64 74 123 207 201 120 47 72 95 110 90;...
12 12 17 9 38 93 148 224 126 115 92 41 54 92 100 65;...
10 17 6 8 49 119 198 414 67 79 42 17 43 59 73 54;...
5 11 7 6 9 29 36 36 454 285 163 50 44 61 72 58;...
5 19 13 5 14 47 75 110 312 236 193 70 47 88 90 76;...
8 12 12 12 20 62 91 230 216 164 174 48 35 85 100 81;...
13 15 20 13 28 72 142 360 96 113 81 49 24 50 77 98];

numoftype_ineachGp=[2,4,2,2,4]
orderof_Gp=[3,2,5,4,1]
cutoff_P=0.05;
columnStart=3;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'C','B','E','D','A'};
model2Graph(selected_model,orderof_Gp,cellLabels)



%test tumor regression
%need check degree freedom nov18.2002
clear all
close all
testdata=[2 0 0 1 1 0 3 0 0 2 2 0 1 1 4 ];
numoftype_ineachGp=[5,3];
cutoff_P=0.05
orderof_Gp=[1 2]
columnStart=1;
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B'};
model2Graph(selected_model,orderof_Gp,cellLabels)


%test Lizeprg
clear all
close all
testdata=[32 86 11 35 61 73 41 70 ];
numoftype_ineachGp=[2,2,2]
orderof_Gp=[1,2 ,3]
columnStart=1;
cutoff_P=0.05
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B','C'};
model2Graph(selected_model,orderof_Gp,cellLabels)


%test leading crowd
clear all
close all
testdata=[458 140 110 49 171 182 56 87 184 75 531 281 85 97 338 554]
numoftype_ineachGp=[2, 2,2,2]
orderof_Gp=[1,2,3,4]
columnStart=1;
cutoff_P=0.05
selected_model=test_GH_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'A','B','C','D'};
model2Graph(selected_model,orderof_Gp,cellLabels)

%test
%Grahical models in multivariant P/261
%%  This data set concerns probable risk factors for coronary heart disease.
%
%  For a sample of 1841 car-workers, the following information was recorded:
%  A: smoker (Y/N), B: strenuous Mental work (Y/N), C: strenuous physical
%  work (Y/N), D: systolic blood pressure, E: ratio of beta to alpha
%  lipoproteins, F: family history of coronary heart disease.
%
%fact a2b2c2d2e2f2
%label a "Smoke (Y/N)" b "Mental work" c "Phys. work"
%label d "Syst. BP" e "Lipo ratio" f "Anamnesis"
%sread fedcba
close all
clear all
testdata=[44 40 112 67 ;...
      129 145 12 23 ;...
      35 12 80 33 ;...
      109 67 7 9;...
      23 32 70 66 ;...
      50 80 7 13 ;...
      24 25 73 57;...
      51 63 7 16 ;...
      5 7 21 9;...
      9 17 1 4;...
      4 3 11 8;...
      14 17 5 2;...
      7 3 14 14;...
      9 16 2 3;...
      4 0 13 11;...
5 14 4 4 ];
numoftype_ineachGp=[2,2,2, 2,2,2]
orderof_Gp=[6,5,4,3,2,1]
columnStart=5;
cutoff_P=0.05
global graph_form
graph_form=2;
selected_model=MGraph_loglineModel(testdata,numoftype_ineachGp,orderof_Gp,columnStart,cutoff_P)
cellLabels={'F','E','D','C','B','A'};
MGraph_model2Graph(selected_model,orderof_Gp,cellLabels)

Contact us at files@mathworks.com