It looks like you can use coding for one categorical variable, but I have two categorical and one continuous predictor variable. Can i use multiple regression for this in SPSS and if so how? thanks!
- If this is an SPSS syntax question, the answer is just put the categorical variable, coded appropriately, into the variable list for "independent variables" along with the continuous one.
- On the statistics: Is your categorical variable binary? If so, you need to use a dummy or other valid contrast code. If it is not binary, is your categorical variable ordinal or nominal? If nominal, then again, you must use some contrasting code strategy--in effect modeling the impact of each level of the variable on the outcome or "dependent" variable. If the categorical variable is ordinal, then most likely the sensible thing to do is to enter it as-is into the model, just as you would with a continuous predictor (i.e., "independent") variable. You would be assuming, in that case, that the increments between levels of the categorical predictor ("indepdent") variable; only rarely will this be a mistake, but when it is, you should again use a contrast code & model the impact of each level. This question comes up in this forum quite often -- here is a good analaysis
- How to handle missing data is, in my view, a completely separate matter. My understanding is that pairwise deletion is not viewed as a valid approach for multivariate regression. Listwise is pretty common but can can also bias results & certainly is a shame. Multiple imputation is a thing of beauty.
You definitely can, by following the same method you'd use for the first categorical predictor. Create dummy variables just as you would for the first such variable. But it's often easier to use SPSS's Unianova command. You can look this up in any printed or pdf'd Syntax Guide, or you can access it through Analyze...General Linear Model...Univariate.
Despite being a little more complicated, the Regression command has a number of advantages over Unianova, though. The chief one is that you can choose 'missing pairwise' (you don't have to lose a case simply because it's missing a value for one or two predictors). You can also get many valuable diagnostics such as partial plots and influence statistics.
A simple way to turn categorical variables into a set of dummy variables for use in models in SPSS is using the do repeat syntax. This is the simplest to use if your categorical variables are in numeric order.
*making vector of dummy variables.
*looping through dummy variables using do repeat, in this example category would be the categorical variable to recode.
do repeat dummy = dummy1 to dummy3 /#i = 1 to 3.
compute dummy = 0.
if category = #i dummy = 1.
Otherwise you can simply run a set of if statements to make your dummy variables. My current version (16) has no native ability to specify a set of dummy variables automatically in the regression command (like you can in Stata using the xi command) but I wouldn't be surprised if this is available in some newer version. Also take note of dmk38's point #2, this coding scheme is assuming nominal categories. If your variable is ordinal more discretion can be used.
I also agree with dmk38 and the talk about regression being better because of its ability to specify missing data in a particular manner is a completely separate issue.