[R] R equivalent of Beaton's Sweep algorithm
Joshua Wiley
jwiley.psych at gmail.com
Mon Nov 29 21:48:53 CET 2010
Hi,
I believe Dr. Harrell has implemented this in the Design package.
This seems to work:
x <- read.table(textConnection("
1 1 1
1 2 4
1 3 9
1 4 16
1 5 25
1 6 36
1 7 49
1 8 64"), header = FALSE)
y <- read.table(textConnection("
3.929
5.308
7.239
9.638
12.866
17.069
23.191
31.443"), header = FALSE)
library(Design)
## seems to agree with the SAS documentation for the parameters
matinv(crossprod(xy), 1:3)[1:3, 4]
Cheers,
Josh
On Mon, Nov 29, 2010 at 12:29 PM, Michael Friendly <friendly at yorku.ca> wrote:
> I'm looking for an R equivalent of Beaton's (1964) Sweep algorithim for
> partial inversion of a
> matrix by pivoting.
>
> It implemented in SAS/IML as sweep(matrix, indices), described here
> http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/langref_sect266.htm
>
> and here for python
> http://adorio-research.org/wordpress/?p=262
>
> --
> Michael Friendly Email: friendly AT yorku DOT ca
> Professor, Psychology Dept.
> York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
> 4700 Keele Street Web: http://www.datavis.ca
> Toronto, ONT M3J 1P3 CANADA
>
> ______________________________________________
> 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list