Search Comments and Ratings

go

   
Date File Comment by Comment Rating
10 Oct 2014 Logrank Comparing survival curves of two groups using the log rank test Author: Giuseppe Cardillo Giuseppe Cardillo

Thank you Jacob.
For the first question, kmplot shows confidence intervals and median time. If I add these lines on Logrank it became too difficult to understand.
For the second question, you can use "text" or "gtext" matlab function to add on to the plot whatever you want.
Feel free to modify the code.

30 Sep 2014 Four parameters logistic regression - There and back again Fit data points with a four points logistic regression or interpolate data. Author: Giuseppe Cardillo Giuseppe Cardillo

I don't know. I should see your data points

15 May 2014 Variable Precision Integer Arithmetic Arithmetic with integers of fully arbitrary size. Arrays and vectors of vpi numbers are supported. Author: John D'Errico Giuseppe Cardillo

Dear John,
I saw that you use the Miller-Rabin algorithm to test primality. considering that are known the strong pseudoprimes to the first 9 prime bases (http://arxiv.org/pdf/1207.0063.pdf), I suggest a little implementation to speed up your Miller-Rabin algorithm:

if N<2047
witnesses=2;
elseif N<1373653
witnesses=[2 3];
elseif N<25326001
witnesses=[2 3 5];
elseif N<3215031751
witnesses=[2 3 5 7];
elseif N<2152302898747
witnesses=[2 3 5 7 11];
elseif N<3474749660383
witnesses=[2 3 5 7 11 13];
elseif N<341550071728321
witnesses=[2 3 5 7 11 13 17 19];
elseif N<3825123056546413051
witnesses=[2 3 5 7 11 13 17 19 23];
else
witnesses=[2 3 5 7 11 13 17 19 23 29 31 37];
end

Regards

03 Apr 2014 MyFisher23 A very compact routine for Fisher's exact test on 2x3 contingency table Author: Giuseppe Cardillo Giuseppe Cardillo

For negative values, gammaln would return INF so that table is not added to computation. Maybe in previous version of gammaln this is not allowed and it calls error. So rows in Tables matrix with negative values must be erased before to give it to gammaln.
[I J]=find(Tables<0); Tables(I,:)=[];
will do this

03 Apr 2014 MyFisher23 A very compact routine for Fisher's exact test on 2x3 contingency table Author: Giuseppe Cardillo Giuseppe Cardillo

try to add this line before line 108
[I ~]=find(Tables<0); Tables(I,:)=[];

03 Apr 2014 MyFisher23 A very compact routine for Fisher's exact test on 2x3 contingency table Author: Giuseppe Cardillo Giuseppe Cardillo

I checked but on my pc the version is the same and the result is

2x3 matrix Fisher's exact test: 540 tables were evaluated
-----------------------------------------------------------------
p-value (2-tails): 0.3537569193
-----------------------------------------------------------------
Mid-p correction: 0.3472754799
-----------------------------------------------------------------

12 Feb 2014 MyFisher33 A very compact routine to compute Fisher's exact test on a 3x3 matrix Author: Giuseppe Cardillo Giuseppe Cardillo

in my PC version it is correct. Bah! I uploaded it again

12 Feb 2014 MyFisher23 A very compact routine for Fisher's exact test on 2x3 contingency table Author: Giuseppe Cardillo Giuseppe Cardillo

Sorry, but it doesn't crash!

myfisher23([ 6 6 9 ; 7 7 9])

2x3 matrix Fisher's exact test: 181 tables were evaluated
-----------------------------------------------------------------
p-value (2-tails): 1.0000000000
-----------------------------------------------------------------
Mid-p correction: 0.9644320759
-----------------------------------------------------------------

07 Jan 2014 CODIS Combined DNA Index System: a GUI tool for forensic paternity lawsuit Author: Giuseppe Cardillo Giuseppe Cardillo

If you want a flowchart explaining how the code works, it is long as a book and anyway the code is heavly commented so you can look at it.

If you want a flowchart explaining how using GUI, I'm surprised because it is very intuitive for Forensic Genetist and there are several demos.
Anyway:
1) choose the population by popupmenu
2) choose the used kit by popupmenu
3) In the option menu, eventually, choose if it is an incestuous relationship or not; direct or reverse parentage (the last if you are not sure that mother is the mother)
4) choose persecutor and defense hypothesis by their popupmenu
5) insert the alleles
6) push on compute button
7) push on report (if you want) and you will find it into REPORT subdirectory into CODIS

That's all

28 Nov 2013 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

the Equal Error Rate (EER) is the point on the ROC curve that corresponds to have an equal probability of miss-classifying a positive or negative sample. This point is obtained by intersecting the ROC curve with a diagonal of the unit square.
Anyway, in the results, it should be the "cost-effective" cut-off point.

27 Nov 2013 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

Simply... I don't know

31 Aug 2013 MyBarnard A very compact and fast routine for Barnard's exact test on 2x2 matrix Author: Giuseppe Cardillo Giuseppe Cardillo

I dont know. I didnt read the original papers. Maybe now computation power is higher and more accurate and precise

08 Aug 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

Sorry, but you should ask this to a statistics...I'm a biochemist that wrote a script using the algorithm of Fisher's least significant difference method (Conover WJ, Practical Nonparametric Statistics (3rd edition). Wiley 1999).
You can find it on https://www.statsdirect.com/help/

13 Jun 2013 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

I have just uploaded a new roc version. You can set the verbose flag and so you will have not plots and results summary, but only the rocout structure

05 Jun 2013 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

to be honest, I haven't. I run on R2012a and it works. Maybe you haven't curvefit toolbox

07 May 2013 Clinical Test Performance The test calculate the performance of a clinical test based on the Bayes theorem Author: Giuseppe Cardillo Giuseppe Cardillo

Noam, the message you get is from a previous version of roc.m routine and not from partest.m. When you have a test, using roc curve analysis you can choose a cut-off point (the point above/below which the test is positive) to obtain the max sensitivity or the max specificity or the max cost effective or the max efficiency or the max positive predictive value...and this choosing depends on your specific problem. Actually, I erased partest invoking from roc to simplify the code.

Anyway, Partest asks whether you want to input the true prevalence of a disease or not. Partest uses the Bayes'es Theorem and the true prevalence is needed to correctly apply it

07 May 2013 Five parameters logistic regression - There and back again Fit data points with a five points logistic regression or interpolate data. Author: Giuseppe Cardillo Giuseppe Cardillo

this is not true!
if you look well at code:

slope=(y(end)-y(1))/(x(end)-x(1));

and so slope can be positive or negative.

Moreover, in the starting points vector:

st_=[min(y) sign(slope) x(Idx) max(y) 1];

sign(slope) is -1 or +1.

So your comment is completely wrong!

29 Apr 2013 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

As I previously wrote, the main paper you have to read is Hanley JA, McNeil BJ. The Meaning and Use of the Area under a Receiver Operating Characteristic (ROC) Curve. Radiology. 1982 Apr;143(1):29-36.
Now I think it is quite impossible to find a paper describing each bayesian parameter, so you could email me in private and I could try to help you.

Adding a costant will not affect results.

12 Apr 2013 Holm-Sidak t-test Holm-Sidak t-test for multiple comparisons Author: Giuseppe Cardillo Giuseppe Cardillo

I don't agree. If you are so able to write a script, it would not to be so difficult to write 1 line of code to obtain an output struct. You can modify my script as you want: it is open source.

11 Apr 2013 CODIS Combined DNA Index System: a GUI tool for forensic paternity lawsuit Author: Giuseppe Cardillo Giuseppe Cardillo

simply do this:
1) in Matlab enter into the directory where you installed CODIS (use the window into the left side)
2) type "CODISpwd=pwd; save CODISpwd.mat CODISpwd; clear CODISpwd"
3) that'all. Anyway I will modify the software.

02 Apr 2013 Four parameters logistic regression - There and back again Fit data points with a four points logistic regression or interpolate data. Author: Giuseppe Cardillo Giuseppe Cardillo

sorry, I did an error when I created the zip file. I'm uploading the correct version

27 Mar 2013 Odds Compute odds and risk ratio on 2x2 matrix Author: Giuseppe Cardillo Giuseppe Cardillo

Look well the matrix you gave to odds!
you wrote x1 = [17, 7; 1707 1786];
so a=17, b=7, c=1707 and d=1786.
If you use the correct matrix of your example
>> x=[17 1690;7 1779];
>> odds(x)
Significance level: 95%

Risk Ratio: 1.0564<2.5410<6.1119
Absolute risk reduction: 0.6%
Relative risk reduction: 60.6%

Odds Ratio: 1.0575<2.5565<6.1801
Phi: 0.0331
Weak positive association (risk factor)

Bayesian Credibility Assessment
Critical Odds Ratio: 11.4919
OR<=COR. Test isn't credible at the 95%

alpha = 0.0500 n1 = 1707 n2 = 1786
Z1-b = 0.1982 Power (2-tails) = 0.5786

To achieve a recommended Power=0.80
n1 = 3203 (add 1496 subjects to exposed row)
n2 = 3351 (add 1565 subjects to not exposed row)

13 Mar 2013 Mann-Whitney-Wilcoxon test Mann-Whitney-Wilcoxon non parametric test for two unpaired groups. Author: Giuseppe Cardillo Giuseppe Cardillo

The results are exactly equal: ranksum gives a 2-tailed p-value and mwwtest gives a 1-tailed p-value. If you need a 2-tailed p-value simply multiply 1-tailed p-value by 2 (or, viceversa, divide 2-tailed p-value by 2 if you need 1-tailed p-value).
For Area Under The Curve, please, look at roc.m function that I wrote.

06 Feb 2013 MyRegression A simple function on LS linear regression with many informative outputs Author: Giuseppe Cardillo Giuseppe Cardillo

Why people always talk before read? Robert Did you read "Description" and "Updates" sections before posting your comments?

25 Jan 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

This is becaming a private lesson of statistic... I should claim my name on the paper....
Anyway if you want my advices:
1) write me in private
2) give me ALL informations (what are you really doing? what is your dataset? What are your classifiers?). It is impossible to give some advice on partial informations.

23 Jan 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

So you can't use any statistical test because they require real number and not probabilities...

23 Jan 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

I think it is correct. If you want to test if classifiers are in agreement or not you have to use Fleiss'es test.

23 Jan 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

yes you are right. Look well if you need Friedman or Fleiss test.

21 Jan 2013 Wilcoxon test non parametric Wilcoxon test for two paired samples Author: Giuseppe Cardillo Giuseppe Cardillo

if you type: wilcoxon it will works showing the example.

in the other cases you have to write:
x1=[n1 n2 n3 n4 n5...ni];
x2=[m1 m2 m3 m4 m5...mi];
wilcoxon(x1,x2)

where n1...ni are the values of the first vector and m2...mi are the values of the second vector.

21 Jan 2013 Wilcoxon test non parametric Wilcoxon test for two paired samples Author: Giuseppe Cardillo Giuseppe Cardillo

Madi, I wrote Wilcoxon to manage two vectors and not a matrix.
nu is the number of inputs that you give to the function. If you change nu...I don't know what are you doing...

21 Jan 2013 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

Madi, SPSS seems to use something like the Bonferroni's correction. When the number of comparisons is very high the Bonferroni's correction is too much conservative (is very difficult to have a statistical difference)

21 Jan 2013 MyFisher33 A very compact routine to compute Fisher's exact test on a 3x3 matrix Author: Giuseppe Cardillo Giuseppe Cardillo

Thank you. If you need fisher onto 2x3 matrix it is on FEX: http://www.mathworks.com/matlabcentral/fileexchange/15399

In any case, you can use Myfisher that it is able to manage any kind of matrix
http://www.mathworks.com/matlabcentral/fileexchange/26883

03 Jan 2013 Superformula generator 2d generator of superformula plot Author: Giuseppe Cardillo Giuseppe Cardillo

yes you are right. It was among first functions I wrote. I fixed the bug and upload the new version.

06 Dec 2012 Wilcoxon test non parametric Wilcoxon test for two paired samples Author: Giuseppe Cardillo Giuseppe Cardillo

No it is not normal: ther is a bug on row 152.
The correct command is:
p=min([1 2*normcdf(zW)]); %p-value

I've just upload the correct version
Thank you

14 Nov 2012 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

By definition, the efficiency is the fraction of subjects that are correctly classified.
TRACE(M) is the sum of the elements on the main diagonal; in our case it is the sum of true positives and negatives.
SUM(M(:)) is the sum of the elements of the matrix and so it is the number of studied subjects.
TRACE(M)/SUM(M(:)) is the efficiency.

08 Jul 2012 Mann-Whitney-Wilcoxon test Mann-Whitney-Wilcoxon non parametric test for two unpaired groups. Author: Giuseppe Cardillo Giuseppe Cardillo

1) if you have to compare more than 2 groups mwwtest is not the test for you...you should use the Kruskal-Wallis test. Or if you have "repeated measures" of the same group in different moments you should use the Friedman's test.

2) the concept of the mwwtest is that if the medians are equals the ranks will distribute equally in both groups and they will have a mean equal to n1*n2/2 (and so you can use Z-score...). The acceptance is the same of the Student's t-test because T (or U) is asintotically normally distributed. The magnitude of T is not the only parameter....if you two very large samples sizes also mean(T) will be very large...

08 Jul 2012 Mann-Whitney-Wilcoxon test Mann-Whitney-Wilcoxon non parametric test for two unpaired groups. Author: Giuseppe Cardillo Giuseppe Cardillo

There are two way to compute T: I setup that described by Stanton Glantz in "Primer of biostatistics". U is related to T by a subtraction factor. Z-score is the same because it is (T-mean(T))/std(T): if you use the other computational method, mean(T) and std(T) change of course. This means that both methods are equivalent.

To reply to your question I have to put off a basically error that everybody do. The question median(1)>median(2) have to be asked BEFORE performing test, during experimental design project. An example: you discover a new diuretic drug. You want to demonstrate that group 1 treated by drug has a median value or urine (mL/24h) higher than group 2 treated by placebo. So you ask to mwwtest if median(1)>median(2). Of course you could decide to treat group 2 by drug: the result of mwwtest will be the same.
In many situations, you can't know BEFORE doing test which median should be greater: if you treat group 1 with drug 1 and group 2 with drug 2 you should not hypothesize which drug will be more effective. So you will ask to mwwtest: are median(1) and median(2) different? In this case you will perform a 2-tailed test and so you have to multiply by 2 the result of mwwtest.

Anyway, don't tell me that you don't know how to ask matlab to compute medians....

28 Jun 2012 Fleiss'es kappa Compute the Fleiss'es kappa for multiple raters Author: Giuseppe Cardillo Giuseppe Cardillo

no you are right

22 Jun 2012 Fleiss'es kappa Compute the Fleiss'es kappa for multiple raters Author: Giuseppe Cardillo Giuseppe Cardillo

Of course, no. Pj is function of Kj and K1=K2 if and only if sum(x.*(m-x)) are equal (m is the numbers of raters).

18 May 2012 Mann-Whitney-Wilcoxon test Mann-Whitney-Wilcoxon non parametric test for two unpaired groups. Author: Giuseppe Cardillo Giuseppe Cardillo

if you like it...
I could decide to set another alpha value for my test (i.e. 0.01) and so your code will give a wrong answare...

10 May 2012 Logrank Comparing survival curves of two groups using the log rank test Author: Giuseppe Cardillo Giuseppe Cardillo

Thank you Jan.
1) You are right. There is a bug in kmplot not in logrank. Now I have just upload the new version of kmplot on FEX. If you need, write me in private and I'll send you the file.
2) they are both correct! I explain. If you are doing a test of a drug against placebo, you will use a 1-tailed test (because, before to do the experiments you are thinking that drug is better of placebo). But if you are testing two different drugs or two different protocols you can only ask to logrank test: Are they different? And so you have to use a 2-tailed test. Of course, 1-tailed test are more powerful but the conditions to apply them are not always respected. Anyway, I'll clarify this in the logrank help and output

29 Mar 2012 KMPlot Plot the Kaplan-Meier estimation of the survival function Author: Giuseppe Cardillo Giuseppe Cardillo

usually you dont exaclty know when a subject really is censored (in example: a patient died between to follow-up points or a patient that decided to not present himself to follow-up). So the best "graphical" choice is to divide the space between to points in to N+1 segments (where N is the censored data between T1 and T2) and to plot a cross for each segments.

12 Mar 2012 MyFriedman Friedman test for non parametric two way ANalysis Of VAriance Author: Giuseppe Cardillo Giuseppe Cardillo

The post-hoc is a nonparametric equivalent to Fisher's least significant difference method (Conover WJ, Practical Nonparametric Statistics (3rd edition). Wiley 1999).
You can find it on https://www.statsdirect.com/help/

07 Mar 2012 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

@Jorge Amaral
Thank you for your comment.
I used your data and this is the result:
ROC CURVE DATA
--------------------------------------------------------------------------------
Cut-off point Sensivity Specificity
0.9000 0.0000 1.0000
0.8000 0.1000 1.0000
0.7000 0.2000 1.0000
0.6000 0.2000 0.9000
0.5500 0.3000 0.9000
0.5400 0.4000 0.9000
0.5300 0.5000 0.9000
0.5200 0.5000 0.8000
0.5100 0.5000 0.7000
0.5050 0.6000 0.7000
0.4000 0.6000 0.6000
0.3900 0.7000 0.6000
0.3800 0.7000 0.5000
0.3700 0.8000 0.5000
0.3600 0.8000 0.4000
0.3500 0.8000 0.3000
0.3400 0.8000 0.2000
0.3300 0.9000 0.2000
0.3000 0.9000 0.1000
0.1000 1.0000 0.1000
--------------------------------------------------------------------------------

ROC CURVE ANALYSIS

--------------------------------------------------------------------------------
AUC S.E. 95% C.I. Comment
--------------------------------------------------------------------------------
0.68000 0.12186 0.44115 0.91885 Poor test
--------------------------------------------------------------------------------
Standardized AUC 1-tail p-value
1.4771 0.069828 The area is not statistically greater than 0.5

so there is not error. If you want contact me by email and we'll try to better understand and to solve

04 Feb 2012 Logrank Comparing survival curves of two groups using the log rank test Author: Giuseppe Cardillo Giuseppe Cardillo

the cyclist is right. He did a perfect explanation

17 Jan 2012 Fisher’s Exact Test Hypergeometric cumulative distribution (left, right and two-tailed) including permutation testing. Author: Michael Boedigheimer Giuseppe Cardillo

I compared your function with the mine using this matrix:
x=[7 12; 8 2].*1000000

Using Myfisher22(x), the function written by me, the result was:
Elapsed time is 5.715080 seconds.

Using your
fexact(x(1),sum(x(:)),x(1)+x(3),x(1)+x(2)) the results were:

??? Maximum variable size allowed by the program is exceeded.

Error in ==> fexact>tri2sqind at 325
k = (1:max_k)';
Error in ==> fexact>getLookup at 211
[k n ind] = tri2sqind(M);
Error in ==> fexact at 142
P = getLookup( M,N,tail);

Same results reducing the complexity to
x=[7 12; 8 2].*100000 and
x=[7 12; 8 2].*10000

When I tried on x=[7 12; 8 2].*1000 the pc looped and after 15 minutes I switched it off.

Finally I tried it on x=[7 12; 8 2].*100
Elapsed time is 6.019058 seconds; using Myfisher22 on this "simple" matrix
Elapsed time is 0.008264 seconds.

So before to write "Other implementations on the file exchange are reportedly buggy and are far too slow for problems I'm working on."
I think that you should test deeper your function.

Regards

17 Jan 2012 MyFisher the definitive function for the Fisher's exact and conditional test for any RxC matrix Author: Giuseppe Cardillo Giuseppe Cardillo

p-value=1-chi2cdf(chi2,df)

27 Dec 2011 MyFisher the definitive function for the Fisher's exact and conditional test for any RxC matrix Author: Giuseppe Cardillo Giuseppe Cardillo

Considering that chi square is an approximation of Fisher's test, in my opinion it is completely useless to have chi square p-value. Anyway, if you want, you can simply set up it using this code:
C=sum(x,1);
R=sum(x,2);
N=sum(x(:));
[r c]=size(x);
df=(r-1)*(c-1);
Ex=R*C/N;
chi2=sum(sum(((x-Ex-0.5).^2)./Ex));
p-value=1-chi2cdf(chi2,gl)

05 Dec 2011 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

this is a problem caused by using a new syntax of matlab that is not supported by your version. Simply do this:
1) edit roc
2) change [~,J]=min(d); into [S,J]=min(d);
3) save and exit

16 Nov 2011 ROCout=roc(varargin) compute a ROC curve Author: Giuseppe Cardillo Giuseppe Cardillo

this error shows that something doesnt work on rocdata and so you have not x in your workspace. Now I have changed and uploaded a new version of roc so, if you call roc without arguments, it will run the demo by itself. If you dont want to wait for the FEX updating simply change in the code the default.value in this way

default.values = {[165 1;140 1;154 1;139 1;134 1;154 1;120 1;133 1;150 1;...

146 1;140 1;114 1;128 1;131 1;116 1;128 1;122 1;129 1;145 1;117 1;140 1;...

149 1;116 1;147 1;125 1;149 1;129 1;157 1;144 1;123 1;107 1;129 1;152 1;...

164 1;134 1;120 1;148 1;151 1;149 1;138 1;159 1;169 1;137 1;151 1;141 1;...

145 1;135 1;135 1;153 1;125 1;159 1;148 1;142 1;130 1;111 1;140 1;136 1;...

142 1;139 1;137 1;187 1;154 1;151 1;149 1;148 1;157 1;159 1;143 1;124 1;...

141 1;114 1;136 1;110 1;129 1;145 1;132 1;125 1;149 1;146 1;138 1;151 1;...

147 1;154 1;147 1;158 1;156 1;156 1;128 1;151 1;138 1;193 1;131 1;127 1;...

129 1;120 1;159 1;147 1;159 1;156 1;143 1;149 1;160 1;126 1;136 1;150 1;...

136 1;151 1;140 1;145 1;140 1;134 1;140 1;138 1;144 1;140 1;140 1;159 0;...

136 0;149 0;156 0;191 0;169 0;194 0;182 0;163 0;152 0;145 0;176 0;122 0;...

141 0;172 0;162 0;165 0;184 0;239 0;178 0;178 0;164 0;185 0;154 0;164 0;...

140 0;207 0;214 0;165 0;183 0;218 0;142 0;161 0;168 0;181 0;162 0;166 0;...

150 0;205 0;163 0;166 0;176 0;],0,0.05,1};

Contact us