[R] an easy way to construct this special matirx

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 16 10:46:50 CEST 2007


?toeplitz
?lower.tri

since it is the lower triangle of a Toeplitz matrix (or drop the top row)

r <- 0.95
R <- toeplitz(r^(0:4))
R[upper.tri(R)] <- 0
R[-1,]


On Thu, 16 Aug 2007, shaowenhua at comcast.net wrote:

> Hi,
> Sorry if this is a repost. I searched but found no results.
> I am wondering if it is an easy way to construct the following matrix:
>
> r      1     0     0    0
> r^2   r     1     0    0
> r^3   r^2  r     1    0
> r^4   r^3  r^2  r    1
>
> where r could be any number. Thanks.
> Wen

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list