Re: [R] Names of variables needed in newdata for predict.glm

2018-03-31 Thread David Winsemius
x" "k" > all.vars(ml$formula) character(0) > all.vars(ml$terms)[ all.vars(ml$terms) %in% names(dat)] [1] "y" "x" -- David. > > ________________________ > Fra: Marc Girondot > Sendt: 8. marts 2018 06:26 > Til: Bendix Carstensen; r-help@r-project.org > Emne: Re: [R] N

Re: [R] Names of variables needed in newdata for predict.glm

2018-03-31 Thread Bendix Carstensen
orm(100) x <- rnorm(100) k <- -1:1 ml <- lm( y ~ bs(x,knots=k) ) mg <- glm( y ~ bs(x,knots=k) ) all.vars(ml$terms) all.vars(mg$terms) all.vars(mg$formula) Fra: Marc Girondot Sendt: 8. marts 2018 06:26 Til: Bendix Carstensen; r-help@r-project.o

Re: [R] Names of variables needed in newdata for predict.glm

2018-03-08 Thread Marc Schwartz
Hi Bendix, If the 'model' argument to glm() is TRUE (the default), you can get the structure of the model frame that was used to fit the model, by using: > str(mx$data) 'data.frame': 200 obs. of 4 variables: $ D: int 0 1 0 1 1 0 1 1 1 1 ... $ x: num 0.705 2.15 0.572 1.249 0.807 ... $ f:

Re: [R] Names of variables needed in newdata for predict.glm

2018-03-07 Thread Marc Girondot via R-help
Hi, Some try: > names(mi$xlevels) [1] "f" > all.vars(mi$formula) [1] "D" "x" "f" "Y" > names(mx$xlevels) [1] "f" > all.vars(mx$formula) [1] "D" "x" "f" When offset is indicated out of the formula, it does not work... Marc Le 07/03/2018 à 06:20, Bendix Carstensen a écrit : I would like to extr