Rank: 490 based on 214 downloads (last 30 days) and 20 files submitted
photo

Bruce Raine

E-mail

Personal Profile:

I like to solve most kinds of maths problems that I come across. I have used MATLAB for around 7 years and really enjoy programming it to solve maths and statistics problems. I hold a Masters degree entitled: Master of Computing and Mathematical Sciences (Hons).

Professional Interests:
Maths and Programming

 

Watch this Author's files

 

Files Posted by Bruce View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 Feb 2012 Convert Degrees, Minutes, Seconds to decimal convdegminssecs.m converts Degrees, Minutes, Seconds to a decimal value Author: Bruce Raine degrees, minutes and seconds 10 0
02 Jan 2012 Plot Wind Direction versus Wind Speed This function can plot polar data onto a compass plot. plotWinDirVel calls another small function Author: Bruce Raine compass, wind direction and wi... 23 1
02 Jan 2012 Hypergeometric Probability Density Function (HPDF) - enhanced version Returns hyper. probability that X = x in sample n. It can now return a cumulative hpdf vector. Author: Bruce Raine hypergeometric probab..., statistics, two colour urn model 7 0
30 Dec 2011 Hypergeometric probability density (HPDF) function Can return the individual and cumulative HPDF. Does not need the Statistics Toolbox. Author: Bruce Raine urn sampling, hypergeometric probab... 7 0
30 Dec 2011 BINOMIALPDF : Binomial Probability Density function BINOMIALPDF Returns the probability that X = k in sample n. Author: Bruce Raine binomial probability ..., statistics, combinatorics 12 0
Comments and Ratings by Bruce View all
Updated File Comments Rating
28 Mar 2013 Odds Compute odds and risk ratio on 2x2 matrix Author: Giuseppe Cardillo

Hi Giuseppe,

Thanks for your answer.

I do admit I messed up the arithmetic bit of my example and should have said:
so RR = (17/1707)/(7/1786) but my numeric answer was correct to 4d.p. I had 1779 instead of 1707.

But from the WIKI def of Risk Ratio (RR):

RR = [a/(a+b)]/[c/(c+d)]

then given RR, and using our data,
e.g. a=17,b=1690,c=7,d=1779
where a+b= 17+1690=1707
and c+d=7+1779=1886

...my input matrix must be
x1 = [ 17, 7;
1707, 1786];

which corresponds to:
(17/1707)/(7/1786)

I don't understand, and please forgive me , why I use this
matrix >> x=[17 1690;
7 1779];

It does not fit your ODDS header input example and does not fit the WIKI def. either.

Also is it possible to add P-values to the ODDS function?

Cheers,

Bruce

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

Hello Giuseppe,
I ran your ODDS function for a microbiologist's data set and we both feel after a little research that ODDS is producing an Odds Ratio rather than a Risk Ratio. Our definitions of Risk ratio and Odds ratio are backed up by WIKI as well and I include the links as well.

e.g.
>> x1 = [17, 7; 1707 1786];
>> odds(x1)
Significance level: 95%

Risk Ratio: 1.1188<1.4494<1.8779
Absolute risk reduction: 22.0%
Relative risk reduction: 31.0%

Odds Ratio: 1.0511<2.5410<6.1425
Phi: 0.0327
Weak positive association (risk factor)
...

You can see that 2.5410 is the Odds ratio according to the data but in fact this should be the Risk Ratio not the value
1.4494 as printed above from ODDS.

We base these assertions on some simple arithmetic backed up by WIKI defs: en.wikipedia.org/wiki/Relative_risk
i.e. Risk Ratio (RR) is defined as:

RR = [a/(a+b)]/[c/(c+d)]

So given this, using our data,
let a=17,b=1690,c=7,d=1779
so RR = (17/1779)/(7/1786) = 0.00996/0.00392 = 2.5410
This is what you have for Odds Ratio but but your Risk Ratio shows 1.4494, a quite different result to 2.5410

Also the Odds Ratio is defined here:
en.wikipedia.org/wiki/Odds_ratio#Example

p1/(1-p1)
---------
p2/(1-p2)

Using the same data as before:

17/1690 0.0100591
------- = --------- = 2.5565
7/1779 0.0039347

Again this is quite different to your ODDS function output for the Odds ratio which has 2.5410.

Are you able to please explain these discrepancies?

Regards,

Bruce

25 Aug 2011 Combinations, n choose k This function finds the combinations of n choose k. Author: Bruce Raine

The binomial coefficient is arguably the most important coefficient in probability. It is the basic building block of probability distribution functions, for example, the Binomial distribution and the Hypergeometric distribution. Indeed, the binomial coefficient sits at the heart ot Probabilistic Combinatorics.

As for replacement and w/o replacement, these two concepts depend on what kind of probability you intend to calculate and not the binomial coefficient. I have written several other functions making use of the binomial coefficient which I may upload soon.

24 Aug 2011 Combinations, n choose k This function finds the combinations of n choose k. Author: Bruce Raine

Actually I tested my function against NCHOOSEK and discovered it was fine until n=54 and then it differed only by a minuscule fraction of the mantissa. It seems stable above that too and incidentally NCHOOSEK becomes unstable at n=54. As for the FACTORIAL function it works well enough and in fact worked up to n=150 inside my function. I can send you my testbed code which shows how well the MYCOMBNK performs against MW function.

29 Jul 2010 Solves a custom set of linear simultaneous equations This solution is for a student (Yvonne) Author: Bruce Raine

Hello Jos,

As MATLAB Central is an unmoderated user forum I know that you are not the moderator. If you want the file I have uploaded removed then please request this from MathWorks directly.

Please note that the file continues to be downloaded so it must be of some use to some people not just Yvonne (if indeed she ever used it).

Regards

Bruce

Comments and Ratings on Bruce's Files View all
Updated File Comment by Comments Rating
11 Jul 2013 Plot Wind Direction versus Wind Speed This function can plot polar data onto a compass plot. plotWinDirVel calls another small function Author: Bruce Raine Phil

Having a problem with desc.

plotWinDirVel(WindDirection,WindSpeedkmh,'Wind Plot')

Cell contents reference from a non-cell array object.

Error in plotWinDirVel (line 31)
lenTitle = length(desc{1});

06 Feb 2013 Plot a surface through X-Y-Z data in 3D Plots X-Y-Z data in 3D using the SURF command. Does not need the Curve Fitting Toolbox. Author: Bruce Raine Hard, Mark

25 Aug 2011 Combinations, n choose k This function finds the combinations of n choose k. Author: Bruce Raine Raine, Bruce

The binomial coefficient is arguably the most important coefficient in probability. It is the basic building block of probability distribution functions, for example, the Binomial distribution and the Hypergeometric distribution. Indeed, the binomial coefficient sits at the heart ot Probabilistic Combinatorics.

As for replacement and w/o replacement, these two concepts depend on what kind of probability you intend to calculate and not the binomial coefficient. I have written several other functions making use of the binomial coefficient which I may upload soon.

24 Aug 2011 Combinations, n choose k This function finds the combinations of n choose k. Author: Bruce Raine Raine, Bruce

Actually I tested my function against NCHOOSEK and discovered it was fine until n=54 and then it differed only by a minuscule fraction of the mantissa. It seems stable above that too and incidentally NCHOOSEK becomes unstable at n=54. As for the FACTORIAL function it works well enough and in fact worked up to n=150 inside my function. I can send you my testbed code which shows how well the MYCOMBNK performs against MW function.

24 Aug 2011 Combinations, n choose k This function finds the combinations of n choose k. Author: Bruce Raine mklcst, mklcst

I really don't understand the purpose of this function.
It's simply a binomial coefficient, it would be better to create the possible combination with and w/o replacement.

Contact us