fallenpegasus: (Default)
/* detecting total precision loss when subtracting two floats */
/* if exponent of the larger of A and B,
minus the exponent of the difference of A and B
is greater than the number of digits of the mantessa,
it's now basically zero, all information lost, that is,
it is smaller than the smallest number representable
by a normalized float with an exponent the same as
the larger of A and B */
int istoosmalldiff_f (float a, float b)
{
float m_frac, d_frac;
int m_exp, d_exp;
m_frac= frexpf(fmaxf(a, b), &m_exp);
d_frac= frexpf((a - b), &d_exp);
/* my libc doesnt define FLT_MANT_DIG, foo! */
/* just hardwire 24 for floats */
return ((d_exp - m_exp) >= (24-1));
}


















Did I get this right?
fallenpegasus: (Default)
In a geeky discussion in a chat, the conversation turned computing the phases of the Moon, I wondered if the POM calculator in emacs needed the observer's lat/lon numbers.

someone: Phases of the moon don't depend noticeably on lat/long - the moon is far enough away compared to the diameter of the earth that to all intents and purposes you see the same hemisphere of the moon no matter where you are on earth. I think they're ususually just calculated wrt the centre of the earth. http://aa.usno.navy.mil/faq/docs/moon_phases.php says "For practical purposes, phases of the Moon and the percent of the Moon illuminated are independent of the location on the Earth from where the Moon is observed."
mra: (looks up numbers, does trig)
mra: the sin of the max angle of view is (12750km / 2) / (384403km / 2)
mra: so the max angle of divergence from plumb is 0.0331743996 radians
mra: which is .005282547 of the full circle, 3.46 hours of the lunar orbit
mra: so the apparent phase can be 3.5 hours early or late, depending on where you are standing on the earth
mra: when something is computing the time of the phase to the closest minute, it looks like your lat/long is significant


Did I get my math right?
fallenpegasus: (Default)
When I was attending university, one of the jobs I had was Research Assistant at the biostatistics department associated with the College of Medicine.

There I learned to operate statistics packages, such as SPSS, BMDP, and S+, under the direction of the statisticians.

We did the statistical analysis of things like drug effectiveness, radiation sensitivity, toxicology, epidemiology, and so forth. We also vetted the statistical models of proposed research projects, under the umbrella of the ethics boards and the research oversight committees. (But that's a different story.)

Anyway, one of our well-funded pay-the-bills study was to investigate a particular medical device, an ultrasound based scanner that the sponsor was hoping could be used for the early detection of malignant prostate cancer.

The datasets we analyzed came from the scanner, from interpreted micrographs of biopsies, and from physicians doing what was delicately referred to as "DRE", aka "Digital Rectal Exam".

One day, I was reading some of the research documentation, and found a clause in the physicians participation agreement that referred types of published analysis that would not be done with the datasets. There was the obvious stuff about personally identifying information, privacy of participants, and so forth.

And then there was a class of verboten disclosure that was described in complex terms, way over my head.

I asked one of the researchers about it, and so she smiled, and then sketched out an analysis for me to run, and then to bring her a printout when it was done.


A short while later, I handed it to her, and she interpreted it to me.

On average, the DRE turned out to be almost a waste of time. And what was worse, for a small but significant number of physicians, they were literally worse than random, at a statistically significant level. That is, if they just reversed all of their diagnosises, they would have done a better job.

It was an amazing and important finding. And it was forbidden by the physican participation agreement for us to officially discover or publish.

The researcher took the printout, and dropped it into the garbage. And we went back to work.

Profile

fallenpegasus: (Default)
Mark Atwood

August 2012

S M T W T F S
   12 3 4
567891011
12131415161718
19202122232425
262728293031 

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Style:
[personal profile] twtd

Expand Cut Tags

No cut tags
Page generated May. 25th, 2013 04:57 pm
Powered by Dreamwidth Studios