Re: [R] Surprising Symbolic Model Formula Evaluations

2019-10-11 Thread William Dunlap via R-help
Look at what terms() (hence lm()) does with such formulae: > str(terms(y~1*x)) Classes 'terms', 'formula' language y ~ 1 * x ..- attr(*, "variables")= language list(y, x) ..- attr(*, "factors")= int(0) ..- attr(*, "term.labels")= chr(0) ..- attr(*, "order")= int(0) ..- attr(*, "intercept

Re: [R] Surprising Symbolic Model Formula Evaluations

2019-10-11 Thread Bert Gunter
Rich: > x <- 1:10 > y <- runif(10) > lm(y ~ 1:x) Call: lm(formula = y ~ 1:x) Coefficients: (Intercept) 0.477 > lm(y ~ x:1) Call: lm(formula = y ~ x:1) Coefficients: (Intercept) 0.477 > lm(y ~ 1*x) Call: lm(formula = y ~ 1 * x) Coefficients: (Intercept) 0.477 > lm(y ~ x*1

Re: [R] Surprising Symbolic Model Formula Evaluations

2019-10-11 Thread Richard M. Heiberger
I can't duplicate your examples This is what I see > y ~ 1:x y ~ 1:x Please try again in a vanilla R session, and send a reproducible example. vanilla means start R from the operating system command line with R --vanilla this prevents any of your initialization files from being loaded. See ?Star