b is nearly singular. Note that one of its eigenvalues is -2.935e-8
which is close to zero. We can use the generalized inverse from
MASS to get one solution, x, but any multiple of the eigenvector
corresponding to the near-zero eigenvalue when added to that
will also give a solution as shown:
>
Nongluck Klibbua reports:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Nongluck
> Klibbua
> Sent: Tuesday, 29 August 2006 11:12 AM
> To: R-help@stat.math.ethz.ch
> Subject: [R] singular matrix
>
> Dear R-users,
&g
Dear R-users,
I try to use "solve" to get the solution of this matrix.But it has error
happen below.
How I can solve this problem.
[1] "a"
[,1]
[1,] 0.8109437
[2,] 5.7569740
[1] "b"
[,1] [,2]
[1,] 0.3141293 2.230037
[2,] 2.2300367 15.831264
Error in solve.default(b, a)
ot; <[EMAIL PROTECTED]>
To:
Sent: Thursday, October 06, 2005 3:11 PM
Subject: [R] Singular matrix
> Dear All,
>
> I have written the following programs to find a non-singular
> (10*10) covariance matrix.
> Here is the program:
>
> nitems <- 10
>
> x &l
Don't you have the dimension of x backward? Try:
> set.seed(1)
> x <- matrix(rnorm(50, 3, 3), 10, 5)
> vinv <- solve(crossprod(x))
> vinv
[,1] [,2] [,3] [,4] [,5]
[1,] 0.019918251 -0.006247646 0.006600209 0.003687249 -0.018670806
[2,] -0.006247646
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(