Michelle Waterman
2010-Feb-14 21:39 UTC
[R] how to delete a parameter from list after running negative binomial error
Hello everyone, Sorry if my question is not clear, my first language is not English, but Portuguese. I am building a model for my data, using non-binomial error. I am having a bit of a problem when updating the model to remove parameters that I no do no autocorrelate with other variables (I have used a autocorrelation function for this). So my first model looks like this: model1.glm.nb<-glm.nb(ozone ~ ., data=climate.dat) summary(model1.glm.nb) model1AIC.glm.nb<-stepAIC(model1.glm.nb) When I run it, it doesn't give me any significance. So I run a second model, with my autocorrelation table, and remove one more variable that does not autocorrelate with other (anything below .07) model2.glm.nb2 <- update(model1.glm.nb, ~ . - rain, data=climate.dat) summary(model2.glm.nb2) Now, when I run a 3rd. model to remove rain, it shows after summary that rain has been removed. Once I do a forth model rain is again in it. How can I remove more than one variable in one go? I was thinking doing something like this: model2.glm.nb2 <-update(model1.glm.nb, ~ . -rain, -temp, data=climate.dat) summary(model2.glm.nb2) Obviously using the - sign is not working and I am getting an error message. Thank you for your help. Michelle [[alternative HTML version deleted]]
Gavin Simpson
2010-Feb-23 08:26 UTC
[R] how to delete a parameter from list after running negative binomial error
On Sun, 2010-02-14 at 21:39 +0000, Michelle Waterman wrote: <snip />> > I was thinking doing something like this: > > model2.glm.nb2 <-update(model1.glm.nb, ~ . -rain, -temp, data=climate.dat) > summary(model2.glm.nb2)Leave out the "," between your terms: model2.glm.nb2 <- update(model1.glm.nb, ~ . - rain - temp, data = climate.dat) HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%