Solved – Simple and multiple logistic regression

logisticrspss

I have almost two questions. I need a single covariate logistic regression (LR) for each of my variables. Should I do it manually in SPSS, selecting each variable and do logistic regression? Is there a "for each" cycle to do it? I should switch to R language to have what I want.

In the multivariables (multi covariates) LR, could I have missing values?

Thanks!!

Best Answer

If I understand you correctly, you want to fit two successive simple logistic regression model. I don't know if there's a specific instruction in SPSS that allows to switch the covariate of interest or cycle through them, but I guess you can run the two models in succession. In R, if your data are organized in a matrix or data.frame, this is easily done as

X <- replicate(2, rnorm(100))  # two random deviates
y <- rnorm(100)
apply(X, 2, function(x) lm(y ~ x))

About your second question, models like this are generally estimated using listwise deletion: any individuals having one or more missing observations on the covariates are deleted before estimating model parameters. Again, in R:

X[2,2] <- NA
summary(lm(y ~ X))

shows that one observation has been deleted, yielding 96 DF (instead of 97).