Saturday, December 22, 2012

Local-ize the Variable Label

In Stata, you can assign virtually any value to a local macro and in the simplest case, you designate the macro with local followed by the name given to the macro followed by the contents of the macro.  

local myvars age gender income sex

local text "The result of the test is "

In the first example, the macro name is myvars and in the second example, the macro name is text.  The first macro might be used as a shorthand way to specify a number of variables for several regression models whereas the second macro might be used if that particular string of text needs to accompany results slated for presentation (say, in a text file).   Not all macros, of course, are this simple or contrived (see Stata's help documentation or just search 'macro' on the Stata listserve to really have your mind blown).  A problem I recently encountered --- and one requiring a little research --- was how to assign a variable label to a macro.  Turns out, this is accomplished via the "extended macro functions" capability and, in retrospect, is somewhat straightforward.  The data attribute we want is the variable label and it is extracted with variable label..  Per the help documentation:

local macroname : variable label varname

You can then use the variable label by calling the local macro.  For a problem I was recently working on, I needed to recode several variables into new variables and instead of retyping the variable label from the original variables into the new variables (pure drudgery!), I wanted to automate the process via a foreach loop.   Below is an example .do file created solely to illustrate the concept (and to remind me how to do this in the future):

* **make 100 observations
set obs 100
* **create two variables, x & y, using random number generator functions
gen x = runiform()        // uniform
gen y = rnormal()        // normal
* **label the variables
label var x "Uniform Distribution"
label var y "Normal Distribution"
* **loop thru both variables and macro out both labels then display them
foreach var of varlist x y {
 local `var'lbl : variable label `var'
 display as text "The variable label of `var' is ``var'lbl'"
*end loop

The output from the foreach loop displays the text inside the double quotes as well as the variable names and labels, respectively:

The variable label of x is Uniform Distribution
The variable label of y is Normal Distribution

Thursday, December 20, 2012

"This is Disgusting"

"This is disgusting.  It's like someone just mashed up the chickpeas and didn't even add any flavor.  Eww."  

<Anguished pause>

"Oh my god.  Did you make this?!?  I'm...I'm, so sorry.  What I meant, err, I didn't...Oh, I'm sorry."

Yup, that happened to my wife.  Really.  A couple of days ago I made hummus from scratch:  I soaked the chickpeas for 8+ hours, boiled them, then processed them with tahini, olive oil, garlic, lemon, paprika, and salt & pepper.  (The recipe I used was from Mark Bittman's "How to Cook Everything Vegetarian".)  Although not perfect, the hummus certainly wasn't dreadful.  Or disgusting.  I've been to Israel so I know what exceptional hummus is suppose to look and taste like and I admit my concoction certainly wouldn't be mistaken for something sold in Jerusalem but, still, really? 

My wife attended her work holiday lunch party and she brought the homemade hummus & pita chips, placed them on the food table, then set about for an hour or so of awkwardly trying to eat and socialize with her colleagues.  When she finally sat down next to the offending colleague --- a bitter, know-it-all woman with a strong opinion on everything and a penchant for judgement --- the bowl of hummus was nearly empty.  (The seat adjacent to this woman was empty for a reason?)  My wife didn't report seeing any other coworkers trying not to betray their disgust of the flavorless hummus so it's reasonable to assume this colleague's opinion wasn't shared by everyone.  Nevertheless, everyone is entitled to their opinion and perhaps my concoction really was the worst she'd ever had but I can't fathom why, and how, a person justifies broadcasting their disgust to anybody who will listen.  And the best part?  This colleague is a diplomat:  a person schooled in the art of being diplomatic, of being likable.  The more I think about this, though, perhaps her honesty is laudable?  Her utter disregard for social mores ("say something nice or don't say anything at all") is both surprising and, weirdly, admirable.  The colleague is just one opinion so she may be a singular exception to the rest of the group but, still, her forthrightness confounds and fascinates. 

In "Lying", a Kindle Single by Sam & Annaka Harris, they say this about "white lies":

But what could be wrong with truly "white" lies?  First, they are still lies.  And in telling them, we incur all the problems of being less than straightforward in our dealings with other people.  Sincerity, authenticity, integrity, mutual understanding --- these and other sources of moral wealth are destroyed the moment we deliberately misrepresent our beliefs, whether or not our lies are ever discovered.

The offending colleague wasn't in a position to tell a "white lie" since she volunteered her opinion without prompting and my wife wasn't likely to query her (or anyone else) on what they thought of the hummus.  There wasn't any opportunity for her to be insincere or inauthentic in this regard since no one asked her opinion.  Needless to say, I doubt anyone will ever accuse this offending colleague of deliberately misrepresenting her beliefs.  This situation, though, begs the question:  was what the offending colleague did grossly offensive or perversely admirable?  My initial reaction was one of offense and shock but now I'm not so sure.  Either way, this occurrence is oddly humorous, especially since a scene from "Love Actually" captures the situation so well: 

Monday, December 17, 2012

'These Tragedies Must End' --- But Will They?

An unmitigated tragedy.  Twenty children gunned down by a disturbed young man.  And at school --- their elementary school.  Dead.  Multiple shots to each body.   A half-dozen administrators also among the dead.  You know American society has reached an all-time low when something like this happens.  I thought we were at our nadir when former congresswoman Gabrielle Giffords was shot in the head but when a crazed gunman opened fire on a bunch of moviegoers in Aurora, Colorado in early summer, the low suddenly sunk even lower.  Turns out whatever foundation we're standing on is made of quicksand.  We keep sinking and sinking.  The response following this latest tragedy has been in line with the previous mass shootings --- horror, outrage, grief, despair, resolve --- although this one seems to elicit a little more outrage and resolve from the political class.  President Obama traveled to Newtown to meet with the victims' families, grieve, and participate in a candlelight vigil but unlike his previous appearances in the wake of a mass shooting, he seems more decisive about doing something, anything, to prevent this from happening again.  But I'm not convinced.  
(Photo credit:

In a previous post, I cynically stated that whatever loss of life results from our constitutional right to bear arms is, unfortunately, collateral damage for a right we hold dear.  My sentiment, admittedly cynical, is downright callous and cruel when the victims are innocent, young children.  My sympathy for the families of the Newtown victims, however, nudges up against a profound sense of resignation.  Do we really think any meaningful legislation will come of this?  Liberals and progressives are calling for a reinstatement of the assault weapons ban and Obama is vowing to use whatever power his office affords him to ensure that these tragedies end.  I remain unconvinced.  If a politician, Gabrielle Giffords, nearly lost her life from a gunshot to the head and absolutely nothing --- not even earnest dialogue --- followed from that then I'm skeptical anything different will emerge from this catastrophe.  In the most honest piece of reporting I've ever read on this issue (a NY Times Op-Ed published on 12/14/2012), a father who lost his son 20 years ago at the hands of a deranged student on a shooting rampage wrote:

"I came to realize that, in essence, this is the way we in America want things to be. We want our freedom, and we want our firearms, and if we have to endure the occasional school shooting, so be it. A terrible shame, but hey — didn’t some guy in China just do the same thing with a knife?"

This father threw himself into the fight to enact gun-control legislation for 20 years but to no successful avail.  Gun-control has become issue non grata on capitol hill and I suspect this tragedy, along with all the others, will also become a distant memory, a talking point, something we'd all like to forget.  That is, until it happens again. 

As I was preparing to leave this morning (while also thinking about this blog post), I turned on the radio and the hauntingly slow and moving version of  Tears for Fears' "Mad World" came on.  The timing of the song was fitting:  this latest madness is hard to take.

Tuesday, December 11, 2012

Big Mistake? Rubbish!

An article currently among the most read/shared on, "Is Waiting To Have Kids a Big Mistake?", is absolute rubbish.  The author, Allison Benedikt, bemoans the fact that her and her husband waited until their thirties to start a family and that, in retrospect, starting in her late twenties would have been the wiser choice.  There are a couple of reasons why I disagree with her but first, a little background.  Ms. Benedikt and her husband live in a smallish Brooklyn apartment with soon-to-be three young children while paying out $5,000 per month for child-care and even though she claims they are "rich" by the standards of most Americans, they stopped contributing to their retirement accounts years ago so they could pay for child-care.  Realizing the risk of alienating and annoying her readers, she admits she can't cry "poverty" simply because her family has little money remaining after their monthly expenses while living in one of the most expensive cities in the world.  Fair enough.  The financial whining aside, though, what really annoys me about this article is the regret she has about having postponed starting a family until she reached her early-thirties (late-thirties for her husband) and the subtle admonishment to not repeat her experience.  If she is going to encourage baby-making at an earlier age then be honest and blunt.  No need to cite statistics about the increased risk of congenital defects from waiting, the slim odds that you won't see your children's 50th birthday, or the unlikelihood of living long enough to interact with your children's children.  And --- this is what compels me to jettison the article to the rubbish bin --- is the assumption that the material lifestyle they currently enjoy is a foregone conclusion.  She admits she spent five years career-building and I contend those five years, along with the many years her husband devoted to his career, education, etc. are the reasons they can fork out $60,000 per year on child-care and live in one of the most expensive and culturally-rich cities in the world.  It is, at best, disingenuous and, at worst, downright dishonest to assume that if she'd had children earlier and foregone all the career-building and time together with her spouse sans kids that her material lifestyle would be the same.  She acknowledges the possibility of being professionless if she had bred many years ago but she conveniently neglects the possibility of not being "rich".

The other reason this article caught my attention (and ire) is how much money her and her husband pay in child-care:  $ 5,000 per month?!?  My immediate reaction is both resignation and shock.  If this is what child-rearing looks like in major American cities --- insanely expensive --- then it is no wonder many young people postpone starting a family until they feel comfortable financially.  Some detractors will argue that if you wait until you are "ready" to have children you'll be waiting forever so why not take the plunge while young and spry?  This is a romantic, but quaint, notion.  And one wholly incompatible with the kind of society America is moving toward:  a society where entrenched inequality is fast-becoming the norm and equality of opportunity is becoming a myth.  Ms. Benedikt need not consider such trivial concerns because her children will always inhabit the land of the "haves", even if her and her husband temporarily suspend contributing to their 401(k)s.  

A NY Times columnist, Ross Douthat, penned a column on December 1st, "More Babies, Please", outlining the problems of decreasing national fertility and encouraging people to have more children so that America can reclaim its global perch.  This article, much like Ms. Benedikt's, riles me up because Douthat has the luxury of advocating for larger families (or starting them earlier in life) when he is unlikely to follow his own advice (either by choice or artifact).  Since it seems like more and more people are keen on "more children!" and "start earlier!" then shouldn't we also be considering realistic policies to encourage and ease the burdens of child-rearing?   A society in which child-care (preschool) costs upwards of $60,000 per year (obviously much less with fewer children in less metropolitan areas) isn't one that encourages families to have two or more children and to have them in their twenties.  Child-rearing is difficult --- it isn't suppose to be a cavalier endeavor --- but I think if the US adopted some of the more family-friendly policies of Western Europe we wouldn't have people like Ms. Benedikt and Mr. Douthat condescendingly pushing for "start earlier!" and "more children!" since most of the population would already be considering as much.

Friday, December 7, 2012

Study Design: Cohort, Case-Control, & Cross-Sectional

In the Ph.D. program in which I'm enrolled, every student must take (and pass) a comprehensive examination (Part 1 of the General Examination) consisting of one epidemiology exam and one biostatistics exam.  Fortunately I'm well past this milestone (I took and passed this exam in late summer 2009), but while studying for this exam, I created a matrix briefly describing the three major study designs (cohort, case-control, & cross-sectional), their advantages & disadvantages, primary biases, and measures of association.  I figured that in addition to needing to know these study designs inside-and-out for the exam,  recording them in a matrix would be helpful for later reference.  Most of the material for the matrix came from my Occupational Epidemiology course notes and text ("Research Methods in Occupational Epidemiology" by Checkoway, Pearce, and Kriebel), although I vaguely recall supplementing it with Rothman, et al.'s "Modern Epidemiology". 

Study Design
Description/Defining Characteristic(s)
Advantages/Intended Uses
Disadvantages/Discouraged Uses
Prominent Bias(es)
Measure of Association
Cohort:  Prospective (Concurrent) and Retrospective (Non-concurrent)
1)  A direct analogue of the experimental study in that the subjects are disease-free at baseline, followed-up over time, then the outcome is observed among the exposed and unexposed groups.   
2)  Includes all persons in the population giving rise to the study cases (rather than a sample). 
The prospective cohort study is ideal for studies where the outcome occurs w/in a relatively short period of time, given the resources necessary to conduct said study. 

The retrospective cohort study, however, is better suited, relative to prospective studies, for studying diseases with a long induction/latency period.

1)  Temporality:  Since the exposure is assessed prior to disease, there is more evidence that the exposure ‘causes’ the disease. 
2)  Exposure is ascertained prior to development of disease.
3)  Minimal selection bias, although if (loss-to) follow-up differs by outcome, then this bias could become problematic.  
4)  Assembly of a cohort can yield a broad picture of the health experience of the cohort.  Allows for investigation of rates for multiple health outcomes (Checkoway, pp.174).  .

The cohort study can be used to study common exposures in “general population” studies (e.g. smoking, oral contraceptives), insofar as the exposure in the exposed group is large enough (don’t want the unexposed to overwhelm the exposed). 
The prospective cohort study is not intended for studies of an outcome w/ a long induction/latency period, e.g. “rare” disease.  Note that a “rare” disease is customarily one where 5% or less of the population will develop the disease. 

The retrospective cohort study may suffer from incomplete data since the investigator is relying on already-collected data and the outcome is most often fatality (easier to verify).

From Rothman, et al., “Cohort studies are poorly suited to study the effect of exposures that are hypothesized to cause rare diseases with long induction periods” (pp.108).
1)  Healthy Worker Effect (HWE):  The bias following form only including the employed in the study – a confounding effect may result since the employed must meet a minimal criterion of health that the at large population does not.
2)  Exposure misclassification:  This is more problematic in case-control studies but it can happen.  One example is using job as a proxy for exposure where the nature of the job and tasks may change over time.
3)  Outcome misclassification (Information Bias):  The disease may be incorrectly classified. 
4)  (Differential) Loss-to-follow-up:  Particularly problematic if associated w/ either exposure or outcome.  A f/up rate <60% likely to yield flimsy study results. 
5)  (MINOR) Selection Bias:  This isn’t terribly problematic at study onset since, in theory, the full source population has been enumerated and is under study.  Nevertheless, if tracing of subjects is related to exposure or outcome, then selection bias may result & mimic that often seen in case-control studies. 
A cohort study yields person-time, thus the Incidence rate is a common measure.  The most common measure of association, however, is the relative risk / rate ratio (RR).
Also known as Incidence case-control; cases obtained via sampling of the source population. 
Attempts to estimate results that a cohort study would have produced by a) including as many of the cases as possible generated by the population at risk, b) sampling from among the non-diseased individuals in the population at risk, c) comparing the frequency (odds) of exposure between the groups. 

Effectively two types:  the nested case-control (cohort-based) that is conducted in the context of a cohort study and, as such, requires the enumeration of the source population and its experience over the risk period.  The second type is your garden-variety case-control study – a community-based case control study.  In this type, the cases are defined first, the source population ascertained, then the controls sampled.
1)  Case-control study is especially useful and appropriate when the disease is RARE (and has a long induction time).
2)  When the community (study population) has a relatively HIGH prevalence of exposure.
3)  Also good when the occupational cohort is difficult to enumerate (e.g. farmers). 

1)  Case-control study is inefficient for rare exposures. 
2)  Selection of controls is of paramount importance, to wit:  “Controls should be selected from the same population – the source population – that gives rise to the study cases.”             

“Although case control studies do present more opportunities for bias and mistaken inference than cohort studies, these opportunities come as a result of the relative ease with which a case-control study can be mounted” (Rothman, et al., pp.112). 

1)  Recall Bias:  Since data is often collected directly from the cases & controls and the cases are obviously aware of their disease status, they may recall differently their exposure. 
2)  Interviewer Bias:  Bias may result if interviewers are poorly trained, not blinded, or o/wise interact w/ cases & controls differently. 
3)  Information Bias:  Primarily a concern since data collected (for exposure) after disease diagnosis – exposure misclassification.
4)  Selection Bias:  Results when cases and controls are not selected from the same (or similar) source population.
(Exposure) Odds Ratio:  Estimates the Rate Ratio (RR) when the case-control is properly conducted.  If the controls in the case-control study are still controls at study end, then the case-control odds ratio estimates the risk ratio obtained from a cohort design. 
Collection of data at one point in time; also known as a one-time survey.  Subjects selected without regard for exposure or disease status.  Good for assessing prevalence at a specific point in time.
Intended for assessing point or period prevalence.
Good for investigating risk factors for nonfatal, progressive diseases w/ no clear point of onset.
Exposure assessed at the same time as disease status.
Not designed for assessing disease incidence. 

Cannot arrive at any semblance of causality – temporality not considered in this type of study. 
1)  Length-biased sampling:  cases included over-represent cases w/ long duration and under-represent cases w/ short duration of illness. 

Prevalence; prevalence odds; prevalence odds ratio (POR). 

Thursday, December 6, 2012

The Soft American --- More Relevant Than Ever

I think it was in a Washington Post article about the JFK 50 mile race that I saw reference to a piece written in late 1960 by then President-elect John F. Kennedy about Americans "getting soft".  I found the article so timely and compelling that I found it on the internet then created a PDF of the article (via $\LaTeX$) so that I could embed it into my blog.  It's obvious the article was written in late 1960 --- there are references to the Soviet threat and one department he names, "The Department of Health, Education, and Welfare", was renamed the Department of Health and Human Services in 1979 --- but its message is as relevant as ever.   One passage, in particular, deserves excerpting:

"For physical fitness is not only one of the most important keys to a healthy body; it is the basis of dynamic and creative intellectual activity. The relationship between the soundness of the body and the activities of the mind is subtle and complex. Much is not yet understood. But we do know what the Greeks knew: that intelligence and skill can only function at the peak of their capacity when the body is healthy and strong; that hardy spirits and tough minds usually inhabit sound bodies.

In this sense, physical fitness is the basis of all the activities of our society. And if our bodies grow soft and inactive, if we fail to encourage physical development and prowess, we will undermine our capacity for thought, for work and for the use of those skills vital to an expanding and complex America.

Thus the physical fitness of our citizens is a vital prerequisite to America's realization of its full potential as a nation, and to the opportunity of each individual citizen to make full and fruitful use of his capacities."

You could argue that JFK was exaggerating the problem and the consequences of slothfulness.  We have, after all, gotten along pretty well economically as a nation in the 50+ years since this piece was published.  Perhaps the observed "softness" was an inevitable result of having one of the strongest and most devoted work ethics in the western world (more time on the job = less time pursuing fitness)??  Even if we set the arguments aside regarding the importance of the issue and whether JFK was right to encourage Americans to step up their physical vigor, I think most of us can concede that the problem has gotten even worse.  If JFK were alive today I think he'd be beside himself.  But since he's not, give his editorial from 1960 a read.

Monday, December 3, 2012

I need new pants

I once worked for an exceptionally smart, highly productive, well-networked, and impeccably dressed CEO of a small, boutique economic consulting firm in Washington, DC.  I could drone on about the nature of the work I did for him, the clients we worked for, the happy hours he paid for, and the various characters I met through him but one thing that always impressed me was his impeccable dress.  He rolled into work every day wearing a perfectly pressed suit, shiny shoes, and classy ties.  I usually arrived in a more-wrinkly-than-not H&M button-down, Express for Men slacks, and scuffed shoes.  Sometimes I ironed my shirts but I mostly relied on the lazy man's steamer:  hanging the shirt from a hook in the bathroom while I showered.  It rarely worked but I figured it was better than nothing.  In retrospect, I should have splurged and properly outfitted myself but this was just the second "real job" I had --- I was less than a year out of my master's program --- and I was still clinging onto the "club hipness" characteristic of my early-to-mid twenties.  It wasn't just the presentation and the quality of clothing that differed, though.  His clothes appeared to fit well.  I thought my clothes, my pants in particular, fit like they were suppose to but little did I know how ill-fitting my pants were until I moved to Austria.  

When my wife and I moved to Vienna a couple of years ago I didn't give my wardrobe too much thought, especially since I was working from home and I could get away with wearing the same pair of ill-fitting jeans for two, maybe three, days in a row.  The cats didn't care and as long as I wasn't wandering around the apartment in the buff waving my junk at the neighbors, Lisa didn't care either.  It didn't become painfully obvious to me how ill-fitting my pants were until we started taking ballroom dance lessons from a local dance studio and I was surrounded by full-length mirrors for 90 minutes each week.  Nearly everyone else seemed to be wearing pants that flattered the lower body, not hide it.  There are many reasons for this, not least of which is the fact that Austrians are far slimmer than the average American so it isn't necessary to hide any unsightly chub underneath a baggy pair of pants.  Every week, I found myself complaining, "These are some ill-fitting pants.  Look how baggy they are.  And the bunchiness near the crotch area from the cinched-up belt isn't flattering either.  I really need new pants."  I think Lisa grew so tired of it that we went shopping for new pants just so I'd shut up.  And it sort of worked, except now I exclaim, "These are some well-fitting pants!".  My wardrobe still has a way to go --- I need to purge the baggy dress slacks from my closet and I'm not yet sporting Brooks Brothers button-downs (like my impeccably dressed friend and former boss) --- but at least I'm now wearing pants that fit

Proposal Packaged in $\LaTeX$

And it looks stunning.  There isn't much need to sing the praises of $\LaTeX$ since so many others have already done so and many more will continue long into the future but I will anyway:  the typesetting software is that good.

In the early stages of writing my dissertation proposal I was using MS Word but as soon as I reached the Methods section of the document and it became obvious I'd be including multiple formulae, I decided the time and energy necessary to gain a working knowledge of $\LaTeX$ would be well worth it.  The prospect of using Equation Editor was dreadfully unappealing.  The ability to easily typeset equations wasn't the only great thing about $\LaTeX$, however.  There is, for example, the seamless formatting of the table of contents with entire document, the straightforward inclusion of a bibliography, the addition of line numbers to each page, and the linking of acronyms to an acronym definition table.  I would be remiss, though, if I claimed the transition was problem- and struggle-free.  But fortunately for me, the $\TeX$ and $\LaTeX$ online forums are well-organized and exceptionally helpful (otherwise there would have been even more head-banging against my desk).  

For my dissertation proposal, I created a primary $\TeX$ file containing my preamble, the title page information, the list of acronyms, then separate \input commands calling each section of my proposal (each section is its own $\TeX$ file):  Abstract, Aims, Background & Introduction, Research Design & Methods, Conclusion, and Appendices.  Pasted below is a polished and slightly abridged version of my main $\TeX$ file (the rudimentary comments preceded with an % are suppose to remind me of what the packages do).

% Author:  CJT      Date: October 2012
% Dissertation master file containing preamble statements, commands, & settings as well as title page.
% Each chapter is referenced via an /include statement.

% Document class is 'book' although some documentation I've read suggests using 'report' for theses/dissertations (oneside).
\documentclass[12pt,oneside,openany]{book}              % Omit blank pages
\usepackage[letterpaper,left=3.2cm,right=3.2cm,top=2.5cm,bottom=2.5cm]{geometry}       % formatting per GWU
\usepackage{textcomp}       % package permitting printing of <, >, |
\usepackage{mathtools}      % package containing math tools, symbols, etc.
\usepackage{graphicx}       % allows for insertion of images
\usepackage{bbding}         % package for changing bullet points
\usepackage{verbatim}       % allows for, among many other things I'm not really aware of, multiline comments 
\usepackage{acronym}        % acronym package
\usepackage{lineno}         % adds line numbers to the output (PDF? DVI?)
\usepackage{wrapfig}        % wraps text around figures & tables.
\usepackage[titletoc]{appendix}     % replaces "A" w/ "Appendix" in ToC
\usepackage{setspace}       % set document to single or double space
\usepackage{arydshln}       % allows dashed lines in tables
\usepackage{hyperref}       % adds hyperlinks to the ToC
    bookmarks=false,         % show bookmarks bar?
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    colorlinks=true,       % false: boxed links; true: colored links
    linktoc=all,            % all of ToC entry is link
    linkcolor=black,          % color of internal links
    citecolor=black,        % color of links to bibliography
    filecolor=black,      % color of file links
    urlcolor=black           % color of external links
%\usepackage[nottoc,numbib]{tocbibind}      %use this if want References section as a numbered chapter.
\renewcommand{\labelitemi}{\OrnamentDiamondSolid}       % change to ornamental diamond
%\renewcommand{\familydefault}{\sfdefault}       % Sans Serif (Arial)
\renewcommand{\rmdefault}{ptm}                      % Times New Roman
\renewcommand{\chaptername}{}       % removes "chapter" from text
\renewcommand{\bibname}{References}         %changes Bibliography to References
\setlength{\parindent}{10mm}                    % Paragraph indentation



%TITLE PAGE:  placing the title page here allows for printing of more than just title, author, and date.
% See ( for the example I followed.

%Creates section of document paginated w/ arabic numbers and not included in ToC (read: Specific Aims not a chapter).

%creates ToC


%add line numbers in the left column for easy reference and editing among committee members
\setpagewiselinenumbers         %reset line numbering on each page
%\modulolinenumbers[5]          %print numbers every five lines

%Dissertation Abstract

%Specific Aims

%The main body of the dissertation w/ Roman numeral pagination...

%change spacing to double space

% Background and Introduction

% Research Design and Methods

% Conclusion

% Appendix (Medications Checklist and Timeline)


% Bibliography
\addcontentsline{toc}{chapter}{References}      %this adds "References" to the ToC but doesn't number it.



I think the number of packages called in the preamble might be a bit excessive but I'm not sure --- perhaps documents of this size and complexity have longer preambles?  I guess I'll find out as I become a more experienced $\LaTeX$ user.  In the meantime, embedded below is a page from the "Research Design and Methods" section of my proposal containing a few equations.  Love $\LaTeX$!

Tuesday, October 23, 2012

Ordinal Regression Probability Ratio

One of the statistical techniques I've proposed to use in my dissertation proposal is ordinal regression (also known as ordered logit, proportional odds model, and cumulative odds model).  This regression model is a direct extension of the binary logistic model except that instead of modeling the probability of a binary event (e.g. alive/dead), you are modeling the probability of an inequality with three or more naturally ordered events (e.g. mild/modest/severe).  Consider the binary logit model:
$\frac{Pr(y = 1 \vert {\boldsymbol{X=x}})}{Pr(y = 0 \vert {\boldsymbol{X=x}})}$
Now consider the ordinal logit model:
$ \frac{P(Y \geq y_i \vert {\boldsymbol{X=x}})}{1 - P(Y \geq y_i \vert {\boldsymbol{X=x}})} = \frac{P(Y \geq y_i \vert {\boldsymbol{X=x}})}{P(Y < y_i \vert {\boldsymbol{X=x}})} $  
(If interested in some background concerning the logit model, you can find a mapping of the inverse logit to the logistic model here, the logit model likelihood function here, and the logit model maximum likelihood estimates here.)

By definition (and derivation) we have this,
$ Pr(Y \geq y_i \vert {\boldsymbol{X=x}}) = \frac{1}{1 + e^{-(\alpha_i + {\boldsymbol{x'_i \beta}})}} $
and this,
$ Pr(Y < y_i \vert {\boldsymbol{X=x}}) = \frac{1}{1 + e^{\alpha_i + {\boldsymbol{x'_i \beta}}}} $

Since the ordinal regression model is the ratio of the two probabilities immediately preceding, the following is obtained after substitution and some minor manipulation:
$ \frac{P(Y \geq y_i \vert {\boldsymbol{X=x}})}{P(Y < y_i \vert {\boldsymbol{X=x}})}  = \frac{1 + e^{\alpha_i + {\boldsymbol{x\beta'}}}}{1 + e^{-(\alpha_i + {\boldsymbol{x\beta'}})}} $
which then reduces to $ e^{\alpha_i + {\boldsymbol{x\beta'}}} $.  

When I was reviewing this a couple of weeks ago, though, I wasn't able to remember how the ratio of the two exponential expressions reduced to the single exponential expression.  Embarrassingly, I mentioned it to my wife (a wicked smart chick with an applied math background) and she thought about it for all of ten minutes then scribbled the solution onto a piece of newspaper.  Although not obvious to me then, the solution seems so obvious to me now:

$ \frac{1 + e^{\alpha_i + {\boldsymbol{x\beta'}}}}{1 + e^{-(\alpha_i + {\boldsymbol{x\beta'}})}} \frac{e^{\alpha_i + {\boldsymbol{x\beta'}}}}{e^{\alpha_i + {\boldsymbol{x\beta'}}}} = \frac{e^{\alpha_i + {\boldsymbol{x\beta'}}}(1 + e^{\alpha_i + {\boldsymbol{x\beta'}}})}{e^{\alpha_i + {\boldsymbol{x\beta'}}}(1 + e^{-(\alpha_i + {\boldsymbol{x\beta'}})})} = \frac{e^{\alpha_i + {\boldsymbol{x\beta'}}}(1 + e^{\alpha_i + {\boldsymbol{x\beta'}}})}{(1 + e^{\alpha_i + {\boldsymbol{x\beta'}}})} = e^{\alpha_i + {\boldsymbol{x\beta'}}} $

Wednesday, October 17, 2012

Optimism: will good things follow?

I defend my dissertation proposal in a few weeks and as I read and review the literature on optimism and pessimism I'm struck by not only the breadth, but the depth of the literature.  I remarked to my wife last night that it feels as if I'm working my way down a wormhole:  it twists, it turns, and just as it looks like I've reached the bottom it continues on.  A person could conceivably spend several weeks doing nothing but searching, reading, and reviewing articles and books dealing with optimism-pessimism, although this may be a questionable use of time and resources since, according to Ebel, Bliefert, & Russey in "The Art of Scientific Writing", the number of sources retrieved for a background/lit review in a dissertation/thesis should be capped at around fifty.  I'm well past that but no sense on dwelling on it now.  At any rate, as part of my literature review and background of my proposal, I've read many papers from the scientific literature as well as a few mainstream, pop psychology books.  There isn't, of course, a consensus on whether being dispositionally optimistic is uniformly beneficial in all settings and circumstances.  If there were then there wouldn't be much point in me pursuing my dissertation question:  does increased dispositional optimism improve medication adherence in a population of people living with HIV/AIDS?  Many of the findings from the scientific literature suggest that being predisposed to optimism affords a person several advantages:  less depression, more active coping strategies, less anxiety, and better health outcomes.  But there are enough papers showing negative or null effects of optimism on health to cast just enough doubt such that the central question --- is optimism good for you? --- remains unresolved.  In the matrix below is a sampling of papers from the scientific literature (an exhaustive list of papers would necessitate a book, not a blog post).  As is evident, more papers than not report positive effects from optimism but this tendency is far from robust.  

As for pop psychology books, the most recent one I read, "Breaking Murphy's Law:  How Optimists Get What They Want from Life --- and Pessimists Can Too" by Dr. Suzanne Segerstrom was decent but suffered from an identity crisis.  The schizophrenia aside, though, Segerstrom marshals the evidence from the scientific literature as well as relies on her research to support her thesis that optimism is a good thing because optimistic people behave in particular ways, e.g. they are more engaged, more focused on goals, and utilize active coping strategies more frequently than their pessimistic brethren.  

On the other end of the optimism-is-good-for-you mainstream books lies Barbara Ehrenreich's "Bright-Sided:  How Positive Thinking is Undermining America".  Unlike Segerstrom's book, Ehrenreich argues that the widespread unerrant positive thinking characteristic of America is tantamount to mass delusion.  She describes her introduction to optimistic thinking by way of a breast cancer diagnosis and how the current of "think positively" was distracting, discouraging, and detracted from the reality of her diagnosis.  She doesn't limit her investigation of optimistic thinking to cancer, however, Ehrenreich also discusses how optimism relates to wealth, business, religion, and the implosion of the American economy.  In the end, Ehrenreich advocates for less bright optimism and for more realism, skepticism, and critical thinking.  

In Tali Sharot's "The Optimism Bias:  A Tour of the Irrationally Positive Brain", there is less polemic and more explanation.  Optimism bias, she explains, is defined as "the inclination to overestimate the likelihood of encountering positive events in the future and to underestimate the likelihood of experiencing negative events" (pp. xv).  Put more simply, it is the tendency to have expectations that are slightly better than what the future holds.  Sharot discusses many situations and settings where optimism bias is present and eventually concludes (with the help of academics cited in her book) that "optimism is like red wine:  A glass a day is good for you, but a bottle a day can be hazardous" (pp. 198). 

So how does all this square with my dissertation?  Well, I'm not sure yet but following approval of my proposal, I'll find out. 

Author(s); (year)
Positive, Negative?
Summary/Main Finding(s)
Non-HIV/AIDS Conditions
Allison, Guichard, et al.; (2003)
Dispositional optimism predicts survival status 1 year after diagnosis in head and neck cancer patients
The LOT was translated into French and the authors followed head & neck cancer patients for the first year following diagnosis.  The multivariate analyses indicated that those who were pessimistic (continuous metric) were 12% more likely to be dead at one-year (OR=1.12, 95% CI 1.01-1.24).
Allison, Guichard, et al.; (2000)
A prospective investigation of dispositional optimism as a predictor of health-related quality of life in head & neck cancer patients
Optimists and pessimists categorized according to score on LOT --- those above median deemed ‘optimists’ and those below deemed ‘pessimists’.  HRQOL measurements made at baseline and three months later w/ optimists rating HRQOL better than pessimists at both time points.  Optimists appear to fare better w/ respect to role & cognitive functioning, less pain and better HRQOL both before and after treatment.
Aspinwall, Taylor; (1992)
Modeling Cognitive Adaptation:  A longitudinal investigation of the impact of individual differences and coping on college adjustment and performance
Positive (qualified)
Optimism exerted a direct, positive effect on subsequent adjustment to college but much of this effect was mediated by coping methods.
Carver, Lehman, Antoni; (2003)
Dispositional pessimism predicts illness-related disruption of social and recreational activities among breast cancer patients
Positive (qualified)
Pessimism predicted higher levels of illness-related disruption in social and recreational activities as well as higher levels of emotional distress and fatigue during year after surgery.  The effects were mediated by distress and fatigue, however.
Carver, Pozo-Kaderman, et al.; (1994)
Optimism versus pessimism predicts the quality of women’s adjustment to early stage breast cancer
Pessimists adjusted more poorly to adverse psychosocial changes.  The sense of pessimism about one’s life enhances risk for adverse psychological reactions to the diagnosis and treatment of breast cancer.
Carver, Smith, et al.; (2005)
Optimistic personality and psychosocial well-being during treatment predict psychosocial well-being among long-term survivors of breast cancer
Investigators examined how optimism-pessimism (from the LOT) influenced well-being over a 5-13 year time frame.  Optimism maintained statistical significance (tempered somewhat in the multivariate setting) with respect to long-term psychological well-being.  Side note:  O-P was repeatedly measured and shown to be stable.
Carver, Gaines; (1987)
Optimism, pessimism, and postpartum depression
Study found that optimism associated (correlated) with resistance to development of postpartum depression at three weeks post-childbirth.  O-P measured via LOT.
Friedman, Nelson, et al.; (1992)
The relationship of dispositional optimism, daily life stress, and domestic environment to coping methods used by cancer patients
Dispositional optimism (via the LOT) was related negatively to avoidance coping but related positively to active-behavioral coping.  Findings suggest that optimists behave (cope) in ways that invite more positive outcomes.
Marshall, Lang; (1990)
Optimism, self-mastery, and symptoms of depression in women professionals
Optimism, as measured by the LOT, overlaps substantially with self-mastery although they are empirically distinct.  Both measures associated with depressive symptoms although only self-mastery associated with symptom levels. 
Mazanec, Daly, et al.; (2010)
The relationship between optimism and quality of life in newly diagnosed cancer patients
Authors examined dispositional optimism (via LOT-R) in population of newly diagnosed cancer patients and found that optimism correlated with anxiety, depression, and spirituality although it did not reach statistical significance in any of the multivariate models (overall HRQOL, physical/social/emotional/functional well-being).
Moyer, Fontana, et al.; (2003)
The role of optimism-pessimism in HRQOL in chronic hepatitis C patients
Positive (qualified)
The LOT was *not* used for the measure of optimism-pessimism so any interpretation should be qualified.  With that said, the findings showed that pessimists exhibited lower QoL of scores and pessimism adversely associated with coping style, overall emotional well-being, and health status in a population of chronic hepatitis C patients.
Schou, Ekeberg, et al. (2004)
Pessimism as a predictor of emotional morbidity one year following breast cancer surgery
Dispositional optimism (via LOT-R) was bifurcated at 18 (<18 pessimist; >=18 optimist) with findings indicating a strong association between LOT score and anxiety and depression at each time point.  Optimism also statistically significant in two multivariate logistic regression models examining anxiety & depression, respectively (optimism confer a beneficial effect).
Schofield, Ball, et al.; (2004)
Optimism and survival in lung carcinoma patients
In a prospective study comparing two treatments for lung carcinoma the investigators administered the LOT at both baseline and post-treatment (six weeks post) and observed a slight decrease (stat significant) decline in optimism between time points as well as a mostly overlapping survival experience (progression-free and overall) among the three arbitrarily selected optimism groups (low, medium, high).  Study adjusted and controlled for some confounders, e.g. performance status, age) but not all, especially depressive symptoms and affectivity (self-efficacy).  Authors conclude that optimism afford no discernible benefit to cancer patients.
Schulz, Bookwala, et al.; (1996)
Pessimism, age, and cancer mortality
Negative (in that optimism didn’t positively affect mortality)
Paper investigating the effects of pessimism, optimism, depression, cancer site, and symptomology on mortality in a sample of 200+ cancer patients.  Optimism and pessimism obtained from the LOT.  Pessimism and depression were significantly positively correlated and pessimism and optimism were significantly negatively correlated.  They conducted hierarchical logistic regression analysis and observed non-significance for main effects of optimism and pessimism on mortality but a statistically significant interaction between age and pessimism.  Younger subjects (30-59) who died exhibited higher pessimism than all other subjects.  Take home message is that pessimistic life endorsement is a risk factor for mortality but only among the younger subjects (30-59).     
Thomas, Britt, et al.; (2011)
Dispositional optimism buffers combat veterans from the negative effects of warzone stress on mental health symptoms and work impairment
A cross-sectional study examining how dispositional optimism (as measured by the LOT-R) moderates the relationship between both acute and chronic warzone stressors and PTSD and depressive symptoms and, also, whether optimism moderates the relationship between mental health symptoms and work impairment.  The authors conclude:  “We found that dispositional optimism buffered both warzone stressors on PTSD symptoms but only deployment demands on depressive symptoms.  The moderating role of dispositional optimism followed the same pattern:  soldiers higher in dispositional optimism reported fewer mental health symptoms when reporting higher levels of warzone stressors compared with soldiers lower in dispositional optimism.  Similarly, soldiers higher in dispositional optimism were less likely than those lower in optimism to report work impairment when experiencing higher levels of PTSD and depression symptoms”
Holmes, Pace; (2002)
HIV-seropositive individuals’ optimistic beliefs about prognosis and relation to medication and safe sex adherence
Investigators sought to determine if women, minorities, and IDUs are as optimistic about their prognosis as other AIDS populations.  Optimism was crudely defined based on expectation of how long the subject expects to live with the results suggesting that those who don’t take their medications were more pessimistic about their life expectancy.
Moyer, Ekpo, et al.; (2008)
Quality of life, optimism/pessimism, and knowledge and attitudes toward HIV screening among pregnant women in Ghana
Negative / Indeterminate
Optimism (per the LOT-R) not associated w/ basic demographics, self-related (mental) health status, QoL, or HIV acceptance.  Curiously, those with the highest levels of optimism had the least amount of HIV knowledge or had not been HIV-tested. 
Question to consider:  Are optimists in denial about risks of disease/hardship they encounter?
Somlai, Kelly, et al. (2000)
Life optimism, substance use, and AIDS-specific attitudes associated with HIV risk behavior among disadvantaged innercity women
The measure of optimism in this study appears to have been created by the authors so any inference is suspect.  That aside, bivariate analyses suggest that higher risk women had lower levels of personal life optimism and in the multivariate analysis (forward stepwise regression) one of the four significant variables was optimism thus suggesting that those w/ lower optimism were more likely to be high-risk for HIV infection.
Taylor, Kemeny, et al.; (1992)
Optimism, coping, psychological distress, and high-risk sexual behavior among men at risk for AIDS
Two types of optimism examined – dispositional and event-based (AIDS) – with the former being derived from the LOT with respect to threat of AIDS infection.  Authors found that dispositional optimism associated with less distress, less avoidant coping, positive attitude as coping strategy, and fewer-AIDS related concerns. 
Milam, Richardson, et al.; (2004)
The Roles of Dispositional Optimism and Pessimism in HIV Disease Progression
Authors examined optimism and pessimism as separate unipolar constructs (as derived from the LOT-R) in relation to disease progression (CD4 count and viral load, respectively).  Bivariate analyses conducted between optimism, pessimism, the dependent variables, and an array of independent variables.  Regression analyses found that higher pessimism associated w/ higher viral load and that moderate optimism associated w/ higher CD4 count.  Per the article, “In summary, the results suggest that low levels of pessimism or moderately high levels of optimism may protect HIV+ persons on ART from progression of disease in the short term.” 
Tomakowsky, Lumley, et al.; (2001)
Optimistic Explanatory Style and Dispositional Optimism in HIV-infected men
Indeterminate / Mildly Positive
Authors sought to investigate effects of optimistic explanatory style and dispositional optimism (from LOT) on HIV symptoms and immune status (CD4 count), respectively.  In multivariate regression models, optimistic explanatory style significantly associated w/ fewer HIV symptoms whereas dispositional optimism moderately associated.  Dispositional optimism not associated w/ CD4 count although optimistic explanatory style related to worse immune function both in cross-sectional and prospective analysis. 
Reed, Kemeny, et al.; (1994)
Realistic acceptance as a predictor of decreased survival time in gay men with AIDS
Negative / Indeterminate
Overarching objective of study was to assess relationship between “realistic acceptance” and survival time so dispositional optimism (via LOT) was tangential to analysis.  That caveat aside, realistic acceptance was not associated with dispositional optimism.  Authors conclude that subjects w/ low realistic acceptance scores survive longer than subjects with high realistic acceptance scores. 
Ironson, Balbin, et al.; (2005)
Dispositional optimism and the mechanisms by which it predicts slower disease progression in HIV:  proactive behavior, avoidant coping, and depression
Prospective study indicates that dispositional optimism (composite of LOT & LOT-R) predicts slower progression of two markers of disease progression:  CD4 count and viral load.  This association, however, was tempered by the inclusion of depression, avoidant coping, and proactive behavioral variables since optimists were more proactive, less depressed, and relied less on avoidant coping.