Endogeneity, anyone?

Wednesday March 28, 2007

Filed under: statistics — jackman @ 11:44 am

Single women reach orgasm ‘more often’ – Breaking News – National – Breaking News

This story was rated #1 in the “most-viewed stories” sidebar of the Sydney Morning Herald this morning.
The newsworthy finding here is that

56 per cent of sexually-active women with no current partner could reach orgasm every time with masturbation compared with only 24 per cent of women with partners.

Could it be that the factors that predispose some women to be (a) relatively more adept/proficient at masturbation and (b) willing to report on these behaviors in a survey are correlated with being single or in a relationship? Discuss.

This is from what sounds like a major, well-funded study in Australia, the Longitudinal Assessment of Ageing in Women, not a sexual behavior/norms study per se, so I’d imagine there would be some attention to these possible threats to inference. But with a finding like this one can’t realistically expect the methodological issues to get much play in any media report. The Murdoch press reported the study reported the findings with the headline “Women do sex better alone“, with an almost-NSFW photo.

I also wonder what might the findings look like (a) stratifying by age and/or sexual orientation; (b) when the outcome is reported frequency of orgasm with a partner; (b) what a parallel study of men would find.

Comments (1)

graph de jour

Tuesday March 27, 2007

Filed under: statistics — jackman @ 10:54 am

I made the following chart in R, showing the distribution of final composite scores in a statistics class I just got done teaching. I scaled the vertical axis on the logit scale, to help me better see differences among students who did relatively well. The trick in R is to use your own axis command, which is pretty easy to do (see longer code fragment below). Indeed, the commonly-used log transformation is built-in to R: e.g.,


It would be nice to have more of that type of thing in R’s plot command.

The graph (click on the thumbnail):
And the R code; the reference to Gossett is because I can’t obviously label the graph with the names of my students (and yes, the pun was intended).

logit <- function(x)log(x/(1-x))
indx <- rev(order(total))
     xlim=c(0,32),       ## give us some room for names
     ylab="Class Score (Logit Transformation)",
     paste("Gossett, ",LETTERS,".",sep=""),


Comments Off on graph de jour

strategic candidate entry in Australian politics (split-ticket voting again)

Monday March 26, 2007

Filed under: Australian Politics — jackman @ 7:48 am

I do think there is something to this argument: i.e., would-be politicos can read the tea-leaves better than most, figure that there is no way the Libs will win at the state-level, so why run for them there, better off waiting for a Federal seat to become vacant (and perhaps the contrary argument holds on the Labor side?). And so the expectation that the Libs will lose state elections becomes something of a self-fulfilling prophecy when poor candidates run. From the PM’s media service:

26 March 2007

Interview with David Speers, Sky News


Prime Minister, good morning. The state and territory Liberals have now lost more than 20 elections in a row. What’s going wrong?

Well I think there’s a number of reasons why they’ve lost so many elections. One of them is that it’s getting increasingly difficult to attract high quality candidates, especially on our side, to go into state politics. I don’t think any of them over recent years have devoted enough time to policy preparation.

This phenomenon (and interest it) could well be on the wane if Labor does as well at the next federal election as current polls suggest it might. If that happens, expect a lot of speculation (and unfounded assertions) about a “realignment” in the Australian electorate.

Comments (3)

Stanford Daily gotcha

Sunday March 25, 2007

Filed under: general — jackman @ 11:54 am

Every year the Stanford Daily publishes a “joke issue”. It usually appears a little earlier than April 1, since that is usually Spring Break around here. The following headline certainly attracted my eye (and that of colleagues and family members). 24 hours later on the 2nd read I finally started to twig. I took great delight explaining to some of my colleagues that it was the Daily’s joke issue.

This table added to the article’s face-validity:

But the content just doesn’t read right:

My eyes were drawn straight to the story under the headline, so I missed this at the top of the front page:


All in all, it is a pretty good joke issue. Some of the other stories inside are almost LOL material: e.g., “Stanford Dining Loses Stanford Account”, “Stanford President John L. Hennessy to speak at Commencement”. Even the Sodoku puzzle was a joke:

Comments Off on Stanford Daily gotcha

Math in Blogs via LatexRender

Friday March 23, 2007

Filed under: statistics,type — jackman @ 9:21 pm

I found LatexRender and after a few hours I seem to have it working: e.g., the normal density is
[tex]p(\theta; \mu, \sigma^2) = \displaystyle\frac{1}{\sqrt{2\pi \sigma^2}} \exp \left[ \displaystyle\frac{-(\theta-\mu)^2}{2\sigma^2} \right][/tex]

which was generated with the following LaTeX code

p(\\theta; \\mu, \\sigma^2) = 
\\displaystyle\\frac{1}{\\sqrt{2\\pi \\sigma^2}} 
\\exp \\left[ \\displaystyle\\frac{-(\\theta-\\mu)^2}{2\\sigma^2} \\right]

enclosed with the tags [tex]...[/tex] (n.b., square brackets)

The BSD version of this installer worked ok for me, at least in the sense of putting the LatexRender PHP files in the right place.

Installation notes. LatexRender is a WordPress plugin. Specifically, is a suite of PHP that gets executed on a per view basis. Blog posts that include that the [tex]...[/tex] tags get the enclosed content parsed and run through LaTeX (absent the LatexRender parser picking up any fatal syntax errors). LaTeX produces a dvi file, which is converted to PostScript (via dvips, which is part of any decent TeX distribution, and the PostScript is run through ImageMagick (which calls Ghostscript) to generate a GIF that appears in-line on the web page. So you need a working TeX and friends installed on your web server, as well as ImageMagick. I use i-Installer for managing these essential pieces of software of this on my work machines, but hadn’t actually put them on my web server. So that took a little while.

ImageMagick didn’t want to play nice, for reasons I don’t quite understand. It works fine straight out of the box on every other OS/X or linux box I’ve owened over the years. I must have got some dependencies screwed up as I hastily installed everything on my web server. So anyway, I wound up installing ImageMagick “by hand”, as follows. I downloaded a pre-compiled binary for Mac OS/X from here, un-tarred it, and moved the libs to /usr/local/lib and the binary executables to/usr/local/bin respectively. Still, LatexRender’s call to ImageMagick’s convert appeared to be failing, and indeed, ImageMagick’s convert refused to run from the command line. Some fishing around in Google revealed that some missing environment variables might fix this problem: I verified this, and then I added the following lines to the top of the class.latexrender.php file (obviously part of in the LatexRender distro):


In addition, at about line 290 of class.latexrender.php I made the following subsitution:

 // imagemagick convert ps to image and trim picture
        $command = $this->_convert_path." -density ".$this->_formula_density.
                    " -crop 0x0 ".$this->_tmp_filename.".ps ".

following this advice.

It seems to work pretty well. The underlying technologies are ancient, in Internet years (tex to dvi to Postscript to ppm to gif); the important value-added here is using PHP to automate the workflow from tagged blog content to in-line GIF. The juxtaposition of all the Helvetica on my blog with the Knuth Computer Modern (rendered as gifs) is a little jarring, and we might be able to tweek that, but in the meantime, this is a vast improvement over x_i^2 etc etc. The other alternative out there is texvc, part of MediaWiki, which seems a nicer solution in principle, but I’d already gone down the WordPress road in setting up the blog, so LatexRender it is (with a little tweeking).

Gratuitious ending of post, proof of the law of iterated expectations:
[tex] \begin{array}{rcl} E_{\mathcal{X}}[E(Y|x)] & = & \int_{-\infty}^{\infty} E(Y|x) \, f_x(x) dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, g(y | x) \, f_x(x) \, dy dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, \displaystyle \frac{f(x,y)}{f_x(x)} \, f_x(x) \, dy dx \\ & = & \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} y \, f(x,y) \, dy dx \\ & = & \int_{-\infty}^{\infty} y \, f(y) dy \\ & = & E(Y) \end{array} [/tex]

Comments Off on Math in Blogs via LatexRender


Filed under: Australian Politics — jackman @ 10:46 am

Wow, when Malcolm Farr’s articles are getting headlines and accompanying photos like this in the Murdoch tabloids, you know something is up.


The web version does not have the same impact, but replaces the photo with this, presenting an even greater contrast between Howard and Rudd:


And also see this other Daily Tele article on how the broadband initiative is shaping up as an issue that will cleave inter-generationally. Coalition Senator Bill Heffernan interjected the comment “I’ve never sent an email in my life” as a jibe, pouring water on Labor’s broadband policy. I’m sure that plays well with a certain segment of the electorate (older, rural, less education), but when the comment attracts the headline “PM’s right hand man asks: What’s email?” in the Daily Tele, the phrases “they just don’t get it” and “time for a change” follow right behind. Wonderful political timing by Rudd, an artfully delivered wedge issue.

Comments Off on www.pm.gone.au

Perspectives on Politics Ice Skating/Constructivism Mash-Up

Filed under: general,statistics — jackman @ 9:24 am

So Perspectives on Politics arrived during the week, with the following cover:

Perspectivesonpolitics V5N1

Huh? Got my attention; nice one Jim. I look inside and find:


The footnote thanks Zorn and Gill and so I’m beginning to put two-and-two together. Indeed, my next thought was that if Duggan and Levitt can do sumo wrestling, then why can’t political scientists do figure skating? And yes, there on the first page (spilling over onto the 2nd page) is the reference to Duggan and Levitt.

In the abstract the authors claim that Olympic figure skating judging constitutes

an arena of international relations in which the observable effect of the identities constitutes by interactions among states can be analyzed independent of those states’ national security concerns.


That said, seems like a fun data set to play with. Looks like ordinal, multiple-rater data to me, with some extra parameters coming in (perhaps hierarchically) to tap the biases.

Comments Off on Perspectives on Politics Ice Skating/Constructivism Mash-Up

Santo Santoro vacancy

Tuesday March 20, 2007

Filed under: Australian Politics — jackman @ 4:42 pm

With Santoro’s resignation it was interesting to hear Queensland Acting Premier Anna Bligh report that the Queensland state government will fill the vacancy with a Liberal Party candidate. As reported by ABC News, Bligh said

I certainly can confirm to the people of Queensland that we will be applying the convention and replacing Senator Santoro with a senator of the Liberal Party.

In fact it is a constitutional requirement that casual Senate vacancies be replaced by members of their own party. Section 15 of the Constitution would seem to apply to Senators like Santoro who were themselves appointed to fill a casual vacancy (Santoro was appointed to fill the vacancy caused by John Herron’s resignation in 2002); the relevant language in section 15 is as follows (emphasis added)

Where a vacancy has at any time occurred in the place of a senator chosen by the people of a State and, at the time when he was so chosen, he was publicly recognised by a particular political party as being an endorsed candidate, a person chosen or appointed under this section in consequence of that vacancy, or in consequence of that vacancy and a subsequent vacancy or vacancies, shall, unless there is no member of that party available to be chosen or appointed, be a member of that party.

Santoro was something of a “mythical figure” during my time at the University of Queensland. In my brief flirtation with student politics there were always dark mutterings about Santoro and the National Civic Council funding Young Liberals efforts on campus, inter alia. “Santo sent ya over here, didn’t he…” was the accusation I heard one night at Student Council, directed from Labor guys and girls over towards the preppy Young Lib types. Being the novice that I was, I had no idea who this “Santo” figure was. Here we are 23 years later…

Comments (2)

Contra Gill Sans

Saturday March 17, 2007

Filed under: type — jackman @ 8:43 am

Typotheque: Eric Gill got it wrong; a re-evaluation of Gill Sans by Ben Archer

My interest in Meta grew out of some dissatisfaction with Gill Sans (and Helvetica) as a typeface for everyday use (on paper, at 12pt sizes and sometime smaller, etc).

Comments Off on Contra Gill Sans

Week 10, Winter Quarter

Tuesday March 13, 2007

Filed under: general,statistics — jackman @ 12:53 pm

Almost done with the linear regression (and friends) class for the quarter… Then the Patagonia catalog arrived and I couldn’t resist.


Comments Off on Week 10, Winter Quarter

Powered by WordPress