HI there, i know this is a basic question, though i need some help because this is somewhat away from my current issue, but nevertheless interesting to me... Lets assume i have some estimated probabilities, say estimated by a logit model. i know i can also state them as an odds ratio. Now i?d like to state these odds ratios as a reference to a specific outcome of my investigated variable. for example, if my covariate of interest is race and possible outcomes are white, black and hispanic, whereas the latter are minorities in my case - how can i state the odds ratio in such a way that white is the reference (always 1) and other races' odds ratio are relative to the reference. e.g. hispanics are 1.5 times more likely to ... Is creating 3 binary dummies for race the right way ? And if so how can i go on. As i said, i know this is rather basic, i am thankful for any links / references... thanks in advance !
odds ratio: how to create reference
4 messages · Bunny, lautloscrew.com, Eik Vettorazzi, Philip Twumasi-Ankrah +1 more
Hi, You can state a probability p as odds p/(1-p) and vice versa. To get an odds ratio you need actually two odds. Then you can get the odds ration of being/having "a" instead of "b" by odds(a)/odds(b), where "b" is the reference level. If you fit a logistic regression model (which means that your outcome is dichotomous) then the estimated coefficients are actually log(oddsratios) - which you can transform to odds by exp() . You can use a factor-variable with three levels for race and treatment-contrasts to get odds ratios for not being white against being white - make sure, that either your factor has "white" as first level or specify the contrast with the "base" argument. If you create 3 dummy variables and involve an intercept in your model your model will be perfectly collinear - the so called "dummy variable trap" - you can use an intercept and create two dummies for the covariate levels you are actually interested in and put this in your logistic model - the result will be the same as with the treatment contrasts. hth. Bunny, lautloscrew.com schrieb:
HI there, i know this is a basic question, though i need some help because this is somewhat away from my current issue, but nevertheless interesting to me... Lets assume i have some estimated probabilities, say estimated by a logit model. i know i can also state them as an odds ratio. Now i?d like to state these odds ratios as a reference to a specific outcome of my investigated variable. for example, if my covariate of interest is race and possible outcomes are white, black and hispanic, whereas the latter are minorities in my case - how can i state the odds ratio in such a way that white is the reference (always 1) and other races' odds ratio are relative to the reference. e.g. hispanics are 1.5 times more likely to ... Is creating 3 binary dummies for race the right way ? And if so how can i go on. As i said, i know this is rather basic, i am thankful for any links / references... thanks in advance !
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Eik Vettorazzi Institut f?r Medizinische Biometrie und Epidemiologie Universit?tsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/42803-8243 F ++49/40/42803-7790
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080923/7f747718/attachment.pl>
Philip Twumasi-Ankrah wrote:
To select another reference level from the default that R chooses you can use the "relevel" function
example;
Reorder Levels of Factorwarpbreaks$tension <- relevel(warpbreaks$tension, ref="M")
summary(lm(breaks ~ wool + tension, data=warpbreaks))
function findlink(pkg, fn) {
var Y, link;
Y = location.href.lastIndexOf("\\") + 1;
link = location.href.substring(0, Y);
link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
location.href = link;
}
This sets "M" as the reference level for the analysis. At the prompt on the R workspace, type
?relevel
A Smile costs Nothing
But Rewards Everything
Happiness is not perfected until it is shared
-Jane Porter
These calculations are automatic using the Design package, e.g. dd <- datadist(d); options(datadist='d') f <- lrm(y ~ pol(age,2)*sex+rcs(weight,4), data=d) summary(f, sex='m') # makes 'm' the reference cell if you don't like the default; gives odds ratios For the sex OR age is set to the median (default; easily changed; doesn't matter if interaction term omitted). Bunny in your original post it would be less confusing if you did not call levels of an independent variable the outcomes. Many people refer to the dependent variable as the outcome variable. Frank
--- On Tue, 9/23/08, Bunny, lautloscrew.com <bunny at lautloscrew.com> wrote: From: Bunny, lautloscrew.com <bunny at lautloscrew.com> Subject: [R] odds ratio: how to create reference To: r-help at r-project.org Date: Tuesday, September 23, 2008, 4:06 AM HI there, i know this is a basic question, though i need some help because this is somewhat away from my current issue, but nevertheless interesting to me... Lets assume i have some estimated probabilities, say estimated by a logit model. i know i can also state them as an odds ratio. Now i?d like to state these odds ratios as a reference to a specific outcome of my investigated variable. for example, if my covariate of interest is race and possible outcomes are white, black and hispanic, whereas the latter are minorities in my case - how can i state the odds ratio in such a way that white is the reference (always 1) and other races' odds ratio are relative to the reference. e.g. hispanics are 1.5 times more likely to ... Is creating 3 binary dummies for race the right way ? And if so how can i go on. As i said, i know this is rather basic, i am thankful for any links / references... thanks in advance !
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University