The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

staran (8) [Avatar] Offline

I am having trouble with Singular Value Decomposition where some of the values are NA in my matrix.

users i1 i2 i3 i4 i5 i6 i7 i8 i9 i10
u1 4 0 NA 2 NA NA 4 NA NA 4
u2 2 0 NA NA NA NA NA NA 1 NA
u3 NA 5 0 3 2 3 5 NA NA NA
u4 NA 5 3 0 2 1 NA 3 3 NA
u5 NA NA NA 0 NA 2 NA NA 3 0

m <- as.matrix(sample(c(NA,0:5),50, replace=TRUE, prob=c(.5,rep(.5/6,6))),nrow=5, ncol=10, dimnames = list(users=paste('u', 1:5, sep=''),items=paste('i', 1:10, sep='')))

I am getting the following error.

Error in svd(m) : infinite or missing values in 'x'. I would appreciate if you would kindly let me know if there is any solution for this.

Kind Regards,