Using R, I run the logistic model and should include the interaction member as follows, where A is categorical and B is continuous.
Y ~ A + B + normalized(B):A
My problem is that when I do this, the reference category is not the same as in
Y ~ A + B + A:B
which makes it difficult to compare models. I'm sure there is a way to make the link category be the same all the time, but it seems it cannot find a direct answer.
To illustrate, my data looks like this:
income ndvi sga 30,000$ - 49,999$ -0,141177617 0 30,000$ - 49,999$ -0,170513257 0 >80,000$ -0,054939323 1 >80,000$ -0,14724104 0 >80,000$ -0,207678157 0 missing -0,229890869 1 50,000$ - 79,999$ 0,245063253 0 50,000$ - 79,999$ 0,127565529 0 15,000$ - 29,999$ -0,145778357 0 15,000$ - 29,999$ -0,170944338 0 30,000$ - 49,999$ -0,121060635 0 30,000$ - 49,999$ -0,245407291 0 missing -0,156427532 0 >80,000$ 0,033541238 0
And the outputs are reproduced below. The first set of results is the form of the model Y ~ A * B, and the second, Y ~ A + B + A: normalized (B)
Estimate Std. Error z value Pr(>|z|) (Intercept) -2.72175 0.29806 -9.132 <2e-16 *** ndvi 2.78106 2.16531 1.284 0.1990 income15,000$ - 29,999$ -0.53539 0.46211 -1.159 0.2466 income30,000$ - 49,999$ -0.68254 0.39479 -1.729 0.0838 . income50,000$ - 79,999$ -0.13429 0.33097 -0.406 0.6849 income>80,000$ -0.56692 0.35144 -1.613 0.1067 incomemissing -0.85257 0.47230 -1.805 0.0711 . ndvi:income15,000$ - 29,999$ -2.27703 3.25433 -0.700 0.4841 ndvi:income30,000$ - 49,999$ -3.76892 2.86099 -1.317 0.1877 ndvi:income50,000$ - 79,999$ -0.07278 2.46483 -0.030 0.9764 ndvi:income>80,000$ -3.32489 2.62000 -1.269 0.2044 ndvi:incomemissing -3.98098 3.35447 -1.187 0.2353 Estimate Std. Error z value Pr(>|z|) (Intercept) -3.07421 0.30680 -10.020 <2e-16 *** ndvi -1.19992 2.56201 -0.468 0.640 income15,000$ - 29,999$ -0.33379 0.29920 -1.116 0.265 income30,000$ - 49,999$ -0.34885 0.26666 -1.308 0.191 income50,000$ - 79,999$ -0.12784 0.25124 -0.509 0.611 income>80,000$ -0.27255 0.27288 -0.999 0.318 incomemissing -0.50010 0.31299 -1.598 0.110 income<15,000$:normalize(ndvi) 0.40515 0.34139 1.187 0.235 income15,000$ - 29,999$:normalize(ndvi) 0.17341 0.35933 0.483 0.629 income30,000$ - 49,999$:normalize(ndvi) 0.02158 0.32280 0.067 0.947 income50,000$ - 79,999$:normalize(ndvi) 0.39774 0.28697 1.386 0.166 income>80,000$:normalize(ndvi) 0.06677 0.30087 0.222 0.824 incomemissing:normalize(ndvi) NA NA NA NA
So, in the first model, the category "revenue <15,000" is a reference category, while in the second model something else happens, which I still do not quite understand.