# BY and WITH command in mixed model SPSS

I coded a variable as 0/1 (species 1 vs. species 2). I assumed that a dichotomous independent variable can be put in the SPSS mixed model as either a "factor" (two levels) ("by") or, if coded 0/1 also as a covariate (predictor) ("with") and that it would not make a difference. But I was wrong. The statistics do change when I use WITH vs. BY. What is the difference between the two and when should I use them?

between subject factor: species subject: 0-1

within subject factors: same_different (stimulus characteristic, do subjects look at their own or the other species): 0-1 stimuluscondition: 0-1 luminance stimulus: continuous variable that I want to control for (it is not of interest)

dependent variable: pupilsize of subject (continuous)

The 'noint' keyword is used to suppress the intercept, because "with int" already defines an intercept.

mixed pupilsize **with** **int** luminance_of_stimulus lin quadr species_subject same_different stimuluscondition
/ fixed int luminance_of_stimulus
species_subject  same_different  stimuluscondition
species_subject*lin same_different*lin stimuluscondition*lin
species_subject*same_different
species_subject*stimuluscondition
same_different*stimuluscondition
species_subject *same_different*stimuluscondition
species_subject*same_different*lin
species_subject*stimuluscondition*lin
same_different*stimuluscondition*lin
species_subject *same_different*stimuluscondition*lin
| noint
/ random int lin | subject(id)  covtype(DIAG)
/ random int lin | subject(id*condition)  covtype(DIAG)
/ repeated = time | subject(id*condition)  covtype(AR1)
/ print solution testcov r.

mixed pupilsize **by** species_subject **with** **int** luminance_of_stimulus lin quadr same_different stimuluscondition
/ fixed int luminance_of_stimulus
species_subject  same_different  stimuluscondition
species_subject*lin same_different*lin stimuluscondition*lin
species_subject*same_different
species_subject*stimuluscondition
same_different*stimuluscondition
species_subject *same_different*stimuluscondition
species_subject*same_different*lin
species_subject*stimuluscondition*lin
same_different*stimuluscondition*lin
species_subject *same_different*stimuluscondition*lin
| noint
/ random int lin | subject(id)  covtype(DIAG)
/ random int lin | subject(id*condition)  covtype(DIAG)
/ repeated = time | subject(id*condition)  covtype(AR1)
/ print solution testcov r.

• You provided no info about your models. Please show syntax of both commands. – ttnphns Feb 22 '12 at 16:14

I notice that you excluded intercept from the fixed factor effects (| NOINT). When there is no intercept in a model, the dichotomous factor is not the same as dichotomous covariate. Just look at an easier example, linear model with dichotomous predictors X1 and X2:

UNIANOVA Y WITH X1 X2
/METHOD= SSTYPE(3)
/INTERCEPT= EXCLUDE
/DESIGN= X1 X2
/PRINT= PARAM.
UNIANOVA Y BY X1 WITH X2
/METHOD= SSTYPE(3)
/INTERCEPT= EXCLUDE
/DESIGN=X1 X2
/PRINT= PARAM.


In both commands, intercept is suppressed. In the first one X1 and X2 are covariates while in the second one X1 is factor. In the presense of intercept, both would have yielded identical results because one of the 2 levels of factor X1 would come out to be redundant which will actually turn X1 into a single covariate. With intercept suppressed, though, both levels of X1 are valid dummy predictors, so you actually have two covariates in place of X1, all in all 3 predictors in the model.

• Thank you for the reply, this is helpful. I am just not sure which model is the correct model and whether I should inlcude | NOINT or not. I don't have any expectations that one species has a larger pupil-size than the other. That is not of interest. I am interested in the three-way interaction between species_subject, same_different, stimuluscondition, to see if the mean pupil size is different, but also if the slope is different. – user9203 Feb 24 '12 at 12:53

Just to avoid the confusion that the question and the answer may create. In the script (SPSS) the 'noint' keyword is used to suppress the intercept, because: the "with int".... already defines an intercept. The variable int is the unit vector defined prior to the linear mixed call. This should have been emphasized. Without the "with int" the answerer would be completely right.

• Thank you for your reply Conor. I edited my original question and emphasized the 'noint' and 'with int' statements. Does anybody else have an answer to my question about when to use the BY and WITH command and what the exact difference is between the two? – user9203 Feb 28 '12 at 15:21