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")= int 1
..- attr(*, "response")= int 1
..- attr(*, ".Environment")=<environment: R_GlobalEnv>
> coef(lm(y~1*x, data=data.frame(y=1:10,x=log2(1:10))))
(Intercept)
5.5
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Oct 11, 2019 at 10:59 AM Richard M. Heiberger <
[hidden email]>
wrote:
> 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
> ?Startup
> for details.
>
> On Fri, Oct 11, 2019 at 1:05 PM Emi Tanaka <
[hidden email]>
> wrote:
> >
> > Hi,
> >
> > I'm wondering about some logics behind the following simplifications:
> >
> > y ~ 1:x simplifies to y ~ 1
> > y ~ x:1 simplifies to y ~ 1
> > y ~ x*1 simplifies to y ~ x
> > y ~ 1*x simplifies to y ~ 1
> >
> > Mainly I would have expected y ~ 1:x to simplify to y ~ x and the cross
> > operator to be invariant to order.
> >
> > I have some further surprising cases below that I'd also like to know
> more
> > about but just above will also be great.
> >
> >
https://rpubs.com/emitanaka/unexpected-formula-eval> >
> > Best,
> >
> > Emi
> >
> > *Dr. Emi Tanaka* | Lecturer in Statistics
> >
> > Faculty of Science, School of Mathematics and Statistics
> >
> >
> > Secretary, NSW Branch, Statistical Society of Australia
> > <
>
https://www.meetup.com/NSW-Branch-of-the-Statistics-Society-of-Australia/>
> >
> > Social Media Coordinator, Central, International Biometrics Society
> > <
https://twitter.com/IBSstats>
> >
> >
> > *THE UNIVERSITY OF SYDNEY*
> > 827, Carslaw F07 | The University of Sydney | NSW | 2006
> > *Phone:* +61 2 9351 3039
> > *Website:* * <
http://sydney.edu.au/>*
https://emitanaka.github.io/> > *Twitter: *@statsgen
> >
> > CRICOS 00026A
> > This email plus any attachments to it are confidential.
> > Any unauthorised use is strictly prohibited. If you receive this email in
> > error, please delete it and any attachments. Please think of our
> > environment and only print this e-mail if necessary.
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> >
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >
https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
>
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>
https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.