Message-ID: <5157B9BF-E500-4C0E-BB93-19611D155663@comcast.net>
Date: 2009-11-29T17:14:32Z
From: David Winsemius
Subject: lm() notation question
In-Reply-To: <4B12A557.2040001@witthoft.com>
On Nov 29, 2009, at 11:46 AM, Carl Witthoft wrote:
> Hi,
> A recent thread provided a (working) construct for lm:
>
> lm(as.matrix(freeny[ix]) ~., freeny[-ix])
>
>
> Can someone explain what is meant by the formula in that expression,
> that is, what does "mymatrix~." do?
It doesn't say my matrix, it says as.matrix, and that is because
freeny[iz] is most probably a dataframe.
The lm function is capable of doing manova when given a matrix on the
LHS of the formula:
http://www.r-project.org/doc/Rnews/Rnews_2007-2.pdf see page 2 and
onward of Dalgaard's article.
Toward the end of the Details section of formula help page (easily
accessed with a click from the lm help page) you will find the
explanation for the "~."
> I couldn't find any such example in the lm() or formula() help pages.
>
> thanks
> Carl
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT