You notice that your reference is for the SAS-procedure glm?!
To play around and since you provided no data example I've created some
data (by an idea from Frank Harrell jr.
http://www.biostat.wustl.edu/archives/html/s-news/2002-04/msg00103.html)
n <- 30
treat <- rep(c('a','b','c'), length.out=n)
lg<- log(1.2)*(treat=='b')+log(1.5)*(treat=='c') # here the intercept
is assumed to be 0 which means that there is an even chance of having
y=1 or y=0 when treat is 'a'.
y <- ifelse(runif(n) <= plogis(lg), 1, 0)
trf<-as.factor(treat)
To have a first look at the data you can do
table(y,treat)
and you can fit your model via
mm<-glm(y~trf,family=binomial(link="logit"))
and to get your odds ratios
exp(coef(mm))
you may look at the model matrix to see that treatment contrasts
correspond to use two dummies for "b" and "c" and an intercept term
(which here refers to the reference level "a")
model.matrix(mm)
hth again.
Bunny, lautloscrew.com schrieb:
Hi,
i found something interesting to me:
http://www.otago.ac.nz/sas/stat/chap39/sect27.htm
and i am about to get an idea of the reference thing ( -1 ) , but
couldn´t connect on the following example:
For the GLM parameterization scheme (PARAM=GLM), the design variables
are as follows.
Maybe you´ll find some time, to take another look.
thanks in advance
Am 23.09.2008 um 11:36 schrieb Eik Vettorazzi:
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@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
--
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
______________________________________________
R-help@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.