Saturday, December 17, 2011

Help with logistic regression?

Hello, Just wondering if someone could help me with some data analysis/regression work I am doing. I am trying to do propensity score matching, but first need to do logistic regression and that's what I am have trouble with.. suppose I have a model as follows: gpa (the dependent variable) and sex and race being the independent variables. So if I want to do logistic regression, do I take the log of all the variables (dependent and independent) first and then do the regression? for example, in STATA do I type 'regress gpa sex race' (using the log of all the variables) to get regression results.. or do I do 'logit gpa sex race' (using the log of all the variables)? Also, in logistic regression, are all the variables meant to be binary (ie. yes and no). because race being a categorical variable and having several categories, do I generate a new variable, that is for example, 1 = black and else 0.. basically do I generate the dummy variable first and then take the log of the dummy variable for logistic regression?


part of my data is as follows:





GPA sex race


3.2 m black


3.5 f black


3.1 m hispanic


3.6 f white


3.2 f white


3.5 m asian


3.3 f hispanic


3.6 m white





part of my stata code is as follows:


gen black = race==black


gen female = sex==f





gen loggpa = log(gpa)


gen logsex = log(female)


gen lograce = log(black)


and then do something like:





logit loggpa logsex lograce or


regress loggpa logsex lograce





does this seem correct for doing logistic regression? Or can someone show me if I must do it differently, in terms of stata commands? I鈥檓 just confused about when to generate the variable, taking the log of the variable and on to regression.





Thanks, any help will be greatly appreciated,





Mike|||I don't quite understand everything you're doing. With logistic regression you usually have a dichotomous outcome - gpa, your outcome, is not dichotomous (is it?) so you can't use that as an outcome. If you are doing propensity matching, your outcome is the thing that you want to match people on (maybe race or sex? And you want to match on gpa?)





Anyway, once you have a dichotomous outcome (I'll call Y and some predictors (I'll call X1, X2) you can either use:





logistic Y X1 X2





If you want to you can use:





logit Y X1 X2





and if you do





logit Y X1 X2, or





that's the same as the first command. (You also forgot the comma).

No comments:

Post a Comment