Avril Coghlan
2004-Jun-09 10:34 UTC
[R] testing effects of quantitative predictors on a categorical response variable
Hello, I have a small statistics question, and as I'm quite new to statistics and R, I'm not sure if I'm doing things correctly. I am looking at two quantitative variables (x,y) that are correlated. When I divide the data set according to a categorical variable z, then x and y are more poorly correlated when z = A than when z = B (see attached figure). In fact x and y are two (correlated) predictor variables and z is a categorical response variable that x and y affect. I would like to use R to make some statistical test to show that you seem to get z = A when the value of x is much less than y, while you tend to get z = B when x is approximately the same as y. Can anybody tell me what I should be doing? I tried a logistic regression:> glm1 <- glm(z ~ y + x,family=binomial(),trace=T)which gives Pr(>|z|) < 0.01 for both x and y, but I'm not sure if this is valid to do, since x and y are correlated? As well this test does not show that it is for values of x << y that we tend to get z = A, and that for values of x approx = y, that we tend to get z = B. I'm not sure how to show this? I'll be very grateful if anyone can help. Avril -------------- next part -------------- A non-text attachment was scrubbed... Name: avril.ps Type: application/postscript Size: 8001 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20040609/ea3dee5c/avril.ps
jferrer@ivic.ve
2004-Jun-09 11:18 UTC
[R] testing effects of quantitative predictors on a categorical response variable
Hi Avril,
I'm not sure what you want to show. Do you want to know the effects of
each variable? or just predict when you get z=A and when z=B?
In the latter case, I think that, if x and y are in the same units, you
could simply try
w <- y-x
glm1 <- glm(z ~ w,family=binomial(),trace=T)
Hope it helps,
JR
En respuesta a / Antwort zu / Reply to:
~~Hello,
~~
~~ I have a small statistics question, and
~~as I'm quite new to statistics and R, I'm not
~~sure if I'm doing things correctly.
~~
~~ I am looking at two quantitative
~~variables (x,y) that are correlated.
~~When I divide the data set according to a categorical
~~variable z, then x and y are more poorly correlated
~~when z = A than when z = B (see attached figure).
~~In fact x and y are two (correlated) predictor
~~variables and z is a categorical response variable that
~~x and y affect.
~~
~~ I would like to use R to make some statistical
~~test to show that you seem to get z = A when
~~the value of x is much less than y, while you
~~tend to get z = B when x is approximately the same as y.
~~Can anybody tell me what I should be doing?
~~I tried a logistic regression:
~~> glm1 <- glm(z ~ y + x,family=binomial(),trace=T)
~~which gives Pr(>|z|) < 0.01 for both x and y, but
~~I'm not sure if this is valid to do, since x and y are correlated?
~~
~~As well this test does not show that it is for values of
~~x << y that we tend to get z = A, and that for
~~values of x approx = y, that we tend to get z = B. I'm
~~not sure how to show this?
~~
~~I'll be very grateful if anyone can help.
~~
~~Avril
~~
Dipl.-Biol. J.R. Ferrer Paris ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laboratorio de Biolog??a de Organismos - Centro de Ecolog??a
Instituto Venezolano de Investigaciones Cient??ficas
Apartado 21827 - Caracas 1020A
REPUBLICA BOLIVARIANA DE VENEZUELA
Tel:00-58-212-5041452 --- Fax: 00-58-212-5041088
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ jferrer at ivic.ve