Oh, so we can always combine model matrices and formulas in regression in R?

Thanks!

On Mon, May 14, 2012 at 2:41 AM, peter dalgaard <pdalgd@gmail.com> wrote:

>
> On May 14, 2012, at 02:24 , Luna wrote:
>
> > Thanks!
> >
> > Do you think if the correctness of the such results could be generalized
> to
> > other future cases?
>
>
> If correctly generalized, yes....
>
> (Apologies for being slightly facetious; the point is that the properties
> you build on are part of the software design for model formulas and model
> matrices. They are not fortuitous buglets, so they are not going to go away
> unless the actual design is changed.)
>
> >
> >
> >
> >
> > On Sun, May 13, 2012 at 7:10 PM, S Ellison <S.Ellison@lgcgroup.com>
> wrote:
> >
> >>> But the line you cited was about "response" being a matrix, which is
> not
> >> our case.
> >> Yes, you're right; I picked the wrong thing to cite.
> >> The only documentation I found about lm accepting a matrix in the
> >> predictors is a one-line statement in "Introduction to R" which says
> "term_i
> >>   is either
> >>
> >>       a vector or matrix expression, or 1,
> >>       a factor, or
> >>       a formula expression consisting of factors, vectors or matrices
> >> connected by formula operators. "
> >>
> >> Not the most informative documentation. But Peter Dalgaard is a most
> >> authoritative source!
> >>
> >>> And also I have checked:
> >>>
> >>> Any more thoughts?
> >>
> >> Data frames are odd things; a column need not contain only a vector if
> the
> >> number of rows is OK. I am half surprised that including a matrix in one
> >> works. But the gods of R are powerful and their magic is strong. Here,
> >> names(tmp) is showing that the data frame has one element called X (in
> >> effect, the whole matrix is regarded as one element of the data frame),
> but
> >> on display the magic has expanded X to show all the columns of X.
> >>
> >> This is the main reason I generally keep to simple things in data
> frames;
> >> complicated things make it less easy to predict behaviour.
> >>
> >>
> >>
> >> *******************************************************************
> >> This email and any attachments are confidential. Any u...{{dropped:13}}
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
> Peter Dalgaard, Professor
>  Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes@cbs.dk  Priv: PDalgd@gmail.com
>
>

	[[alternative HTML version deleted]]

