5
$\begingroup$

I use SPSS, but am forced to use R for exact logistic regression. So I'm brand new to R (and hating it so far) and also new to logistic regression. I've read the original elrm paper and looked at examples of its use. However, I can't find information on the questions below (after the data description).

The fit of two models of cognitive processing was compared for each subject in each of 3 conditions. My binary dependent variable is whether the difference in model fits was significant or not (my "Success" variable below). I have three experimental Conditions: 0, 1, and 2. 0 is my reference group. My question is: is there an overall effect of Condition? If so, which conditions differ? The specific alternative hypothesis is that the proportion/probability of "success" should be greater in conditions 0 and 1 than in condition 2. My data look like

original data

...and so on. SPSS actually creates the dummy variables for you on the fly but they are easy enough to create explicitly.

Question 1: I have read that to use elrm you have to enter the data such that the response variable represents success/number of trials. And as far as I can tell elrm doesn't create dummy variables automatically. I've seen examples of tables representing this data structure, but can't find any step-by-step examples of getting raw data into that format, espescially given a one-variable 3-levels situation. Is there an example out there that I'm missing? If not, is this what the data should look like?

reformated data

I'm not sure how I'd enter the dummy variables into the formula...just as separate variables?

Question 2: I can see how I can get the tests of the coefficients of the dummy variables. But I can't figure out how to get a test of the overall effect of the independent variable. I need to evaluate the overall effect of Condition before looking at individual conditions. Is there a way to get that out of elrm? (I found an example of this done for the aod package which runs regular logistic regression but not exact logistic regression.)

Question 3: I can't find a description of what the p-value for individual coeffeicients represents in elrm. Is this is for the Wald test?

$\endgroup$
  • $\begingroup$ Which paper are you referring to? What package are you using in R - the CRAN package that's actually called elrm or something else? If you're finding R difficult (and coming from SPSS it might be hard), have you seen this? The author also has a more recent book by the same title. $\endgroup$ – Glen_b Jul 9 '14 at 0:40
  • $\begingroup$ @Glen_b I found the paper at CRAN link and at the Journal of Statistics Software (although their site seems to be down). But it's geared toward experienced users. The R for SPSS users looks helpful though, thanks. $\endgroup$ – Michelle Jul 9 '14 at 2:52
  • $\begingroup$ The thing you linked to there is the manual. The manual may seem confusing, but it's a goldmine of precise information. If you want a basic 'how to use this' type document, the vignettes that many packages have are usually a good way to start. But don't ignore the manual completely, since it often tells you how to do things the vignette or vignettes don't cover. Pay particular attention to the examples section at the end of the manual entries to get a sense of how functions are used. $\endgroup$ – Glen_b Jul 9 '14 at 5:37
  • 1
    $\begingroup$ The titanic example at the bottom of page 6 of the manual you linked to suggests it does create dummies automatically - that formula has a factor in it. R handles factors automatically, you don't even see the dummies. [Even if elrm somehow didn't handle factors by itself, it's easy to generate a set of dummies in R - e.g. if you have a factor called x, then model.matrix(~x)[,-1] will generate dummies for every factor level after the first. Try (x=as.factor(sample(LETTERS[1:3],10,replace=TRUE))); model.matrix(~x)[,-1] and see] $\endgroup$ – Glen_b Jul 9 '14 at 5:47
  • $\begingroup$ @Glen_b Ahh, ok. That makes way more sense than not having the ability to automatically create dummies. I didn't quite realize what as.factor was doing (still working on getting the data structure down). I'll have to look into the examples in more detail. Thanks! $\endgroup$ – Michelle Jul 10 '14 at 0:21
3
$\begingroup$

My reading of the literature on exact logistic regression is that it has the same problems of power loss that Fisher's "exact" test has. What got you interested in exact logistic regression? A better approach may be to use penalized maximum likelihood estimation with ordinary unconditional logistic regression. ["Exact" logistic regression is a type of conditional analysis in the same sense as Fisher's test, i.e., it in some ways changes the hypotheses one tests by conditioning on certain margins.]

$\endgroup$
  • $\begingroup$ OK, I hadn't run across that criticism yet. Normally I work with continuous data, so I'm interested only because I've (oddly) ended up with a binary variable to analyze, tied to one independent variable with 3 levels and with some cells with less than 5 successes. So digging around various stats resources with these conditions led me to exact logistic regression. I'll look into penalized MLE, thanks. $\endgroup$ – Michelle Jul 9 '14 at 3:19
  • $\begingroup$ Depending on the minimum of the frequency of 0's and of 1's you may get by with ordinary logistic regression (unpenalized). $\endgroup$ – Frank Harrell Jul 9 '14 at 11:35
  • $\begingroup$ Unfortunately I've got a minimum of 1 in a couple of cases, so I'm thinking a conservative approach is probably going to be necessary. $\endgroup$ – Michelle Jul 10 '14 at 0:36
  • $\begingroup$ Things have to get very extreme for the conditional exact method to be more accurate than the unconditional conventional MLE method. $\endgroup$ – Frank Harrell Jul 10 '14 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.