Dear all, this might be not only an R-question but also a statistical. When I do a logistic regression analysis (species distribution modeling) with function lrm (Design package) I get the follwoing error message: > tadl1<-lrm(triad~fd+dista+fd2+dista2+fd:dista+dista:geo2, x=T, y=T) Error in if (!length(fname) || !any(fname == zname)) { : missing value where TRUE/FALSE needed The problem seems to be that geo2 (factor variable with 3 levels) is not included as main effect. But when I run the same model with glm it is working properly. However, from an ecological point of view, inclusion of only the interaction term makes sense. When running the model with inclusion of both main effect and interaction, main effect has no significant influence and the interaction only marginaly. And LR-Test underlines model simplification. Does anyone know how to solve the problem? I need the lrm function since I have to validate my models via bootstrapping (validate.lrm). Many thanks! Eva -- Eva Mosner Lilienstra?e 9 35043 Marburg 06421-8400886 0151-17867488
Frank E Harrell Jr
2008-Apr-01 18:09 UTC
[R] lrm -interaction without main effect-error message
Eva Mosner wrote:> Dear all, > > this might be not only an R-question but also a statistical. > When I do a logistic regression analysis (species distribution modeling) > with function lrm (Design package) I get the follwoing error message: > > > tadl1<-lrm(triad~fd+dista+fd2+dista2+fd:dista+dista:geo2, x=T, y=T) > > Error in if (!length(fname) || !any(fname == zname)) { : > > missing value where TRUE/FALSE needed > > > The problem seems to be that geo2 (factor variable with 3 levels) is not > included as main effect. But when I run the same model with glm it is > working properly. > However, from an ecological point of view, inclusion of only the > interaction term makes sense. When running the model with inclusion of > both main effect and interaction, main effect has no significant > influence and the interaction only marginaly. And LR-Test underlines > model simplification. > Does anyone know how to solve the problem? I need the lrm function since > I have to validate my models via bootstrapping (validate.lrm). > > Many thanks! > Eva >No! The test of a 'main effect' that you did is not a valid test and it invalidates the hierarchy principle. Don't get lulled into thinking that parsimony is a good thing. Besides getting strange fits you will not preserve type I error or confidence interval coverage. If you were doing ols you would be getting an invalid estimate of sigma. Model simplification is warranted if you tested an appropriate group of parameters with a test that has a large number of degrees of freedom. For example, you might argue that ALL interaction terms could be dropped if the P-value for the combined effects of all interaction parameters is 0.3. You might argue that one predictor could be dropped if the combined effects of all main effects and interaction effects containing the predictor gives a P-value of 0.25. Both of these tests also respect the hierarchy principle. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University