Re: [R] boot.stepAIC fails with computed formula

2017-08-24 Thread Stephen O'hagan
-Original Message- > From: Bert Gunter [mailto:bgunter.4...@gmail.com] > Sent: 22 August 2017 20:38 > To: Stephen O'hagan <soha...@manchester.ac.uk> > Cc: r-help@r-project.org > Subject: Re: [R] boot.stepAIC fails with computed formula > > OK, here's the problem. Continu

Re: [R] boot.stepAIC fails with computed formula

2017-08-23 Thread Bert Gunter
unter [mailto:bgunter.4...@gmail.com] >> Sent: 22 August 2017 20:38 >> To: Stephen O'hagan <soha...@manchester.ac.uk> >> Cc: r-help@r-project.org >> Subject: Re: [R] boot.stepAIC fails with computed formula >> >> OK, here's the problem. Continuing with your e

Re: [R] boot.stepAIC fails with computed formula

2017-08-23 Thread Heinz Tuechler
.@gmail.com] Sent: 22 August 2017 20:38 To: Stephen O'hagan <soha...@manchester.ac.uk> Cc: r-help@r-project.org Subject: Re: [R] boot.stepAIC fails with computed formula OK, here's the problem. Continuing with your example: strt1 <- lm(y1 ~1, dat) strt2 <- lm(frm1,dat) strt1 Call: lm(form

Re: [R] boot.stepAIC fails with computed formula

2017-08-23 Thread Stephen O'hagan
8:51 To: Stephen O'hagan <soha...@manchester.ac.uk> Cc: r-help@r-project.org Subject: Re: [R] boot.stepAIC fails with computed formula SImplify your call to lm using the "." argument instead of manipulating formulas. > strt <- lm(y1 ~ ., data = dat) and you do not need to

Re: [R] boot.stepAIC fails with computed formula

2017-08-23 Thread Stephen O'hagan
oha...@manchester.ac.uk> Cc: r-help@r-project.org Subject: Re: [R] boot.stepAIC fails with computed formula OK, here's the problem. Continuing with your example: strt1 <- lm(y1 ~1, dat) strt2 <- lm(frm1,dat) > strt1 Call: lm(formula = y1 ~ 1, data = dat) Coefficients: (Intercept)

Re: [R] boot.stepAIC fails with computed formula

2017-08-22 Thread Bert Gunter
OK, here's the problem. Continuing with your example: strt1 <- lm(y1 ~1, dat) strt2 <- lm(frm1,dat) > strt1 Call: lm(formula = y1 ~ 1, data = dat) Coefficients: (Intercept) 41.73 > strt2 Call: lm(formula = frm1, data = dat) Coefficients: (Intercept) 41.73 Note that the

Re: [R] boot.stepAIC fails with computed formula

2017-08-22 Thread Bert Gunter
SImplify your call to lm using the "." argument instead of manipulating formulas. > strt <- lm(y1 ~ ., data = dat) and you do not need to explicitly specify the "1+" on the rhs for lm, so > frm2<-as.formula(paste(trg," ~ ", paste(xvars,collapse = "+"))) works fine, too. Anyway, doing this

Re: [R] boot.stepAIC fails with computed formula

2017-08-22 Thread Bert Gunter
Failed? What was the error message? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Aug 22, 2017 at 8:17 AM, Stephen O'hagan

Re: [R] boot.stepAIC fails with computed formula

2017-08-22 Thread Steve O'Hagan
The error is "the model fit failed in 50 bootstrap samples Error: non-character argument" Cheers, SOH. On 22/08/2017 17:52, Bert Gunter wrote: Failed? What was the error message? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking

[R] boot.stepAIC fails with computed formula

2017-08-22 Thread Stephen O'hagan
I'm trying to use boot.stepAIC for feature selection; I need to be able to specify the name of the dependent variable programmatically, but this appear to fail: In R-Studio with MS R Open 3.4: library(bootStepAIC) #Fake data n<-200 x1 <- runif(n, -3, 3) x2 <- runif(n, -3, 3) x3 <- runif(n,