Re: [R] Singular matrix

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Thu 06 Oct 2005 - 23:45:49 EST

'x' is a rank 5 matrix from which you want to create a rank 10 crossproduct! Try the following instead:

x <- array(rnorm(100 * nitems, 3, 3), c(100, nitems)) sigma <- crossprod(x)

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


> Dear All,
>
> I have written the following programs to find a non-singular
> (10*10) covariance matrix.
> Here is the program:
>
> nitems <- 10
>
> x <- array(rnorm(5*nitems,3,3), c(5,nitems))
>
> sigma <- t(x)%*%x
>
> inverse <- try(solve(sigma), TRUE)
>
>
>
> while(inherits(inverse, "try-error"))
>
> {
>
> x <- array(rnorm(5*nitems,3,3), c(5,nitems))
>
> sigma <- t(x)%*%x
>
> inverse <- try(solve(sigma), TRUE)
>
> }
>
>
>
> The loop doesn't stop ... This means that no "non-singular" matrix
> was found!!!
>
> some thing wrong !!
>
>
>
> Thanks a lot for any reply
>
>
>
> Bernard
>
>
>
>
>
>
>
>
>
> ---------------------------------
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 06 23:53:11 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:25:14 EST