0

in part of my code, I have something like :

for(i in 1:k){
  for(j in 1:n){
    coeff <- tr(ginv(Sigma.list[[i]])%*%(Yi.list[[j]]-Mu.list[[i]])%*%A2%*%t(Yi.list[[j]]- 
    Mu.list[[i]]))}} 

Yi s are each of n 2by40 observation matrices which are grouped in different clusters. Sigmas are 2by2 var matrix in each cluster i. Mu s are mean matrix in each cluster i. , A2 is formed from

    A2 <- array(0, c(Tt, Tt))

for (i in 1:Tt){
  if (i == 1){
    A1[i,(i+1)] <- 1
  }else if (i == Tt){
    A1[i,(i-1)] <- 1
  }else {
    A1[i,(i-1)] <- 1
    A1[i,(i+1)] <- 1
    A2[i,i] <- 1
  }
}


  

I get error : Error in svd(X) : infinite or missing values in 'x'

as far as I check, I do not have any missing value or zero matrices or infinite ones. what does this error exactly telling me?

Mathica
  • 1,241
  • 1
  • 5
  • 17
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Jul 22 '21 at 18:28
  • 1
    Did you check using the is.finite function? – Bill O'Brien Jul 22 '21 at 18:37
  • 1
    @Bill O'Brien, oh I realized Sigma.list[[5]] has inf value for all its element :( – Mathica Jul 22 '21 at 18:48

0 Answers0