Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'y'

31 Views Asked by At

I'm running the following command: cov.28.pc.raw <- PCs_Wcov$28 ##PCS_Wcov was obtained by: PCs_Wcov = llply(Wcov_all, eigen), where PCs_Wcov are the weighted averages of covariance matrices along a phylogeny, returning a within-group covariance matrix for each node. projection.cov.28.pc.raw <- as.matrix(aMeans_28_df[,-1]) %*% cov.28.pc.raw$vectors #aMeans are the averages (17 cranial distances) of the living species (ends of the phylogeny) within that node, in this case the ancestral node 28 gave rise to the current 4 species log.cov.28.var.raw <- log(apply(projection.cov.28.pc.raw, 2, var)) log.cov.28.pc.values.raw = log(cov.28.pc.raw$values)

rate_matrix.28.pc.raw <- eigen(rate_matrix.28) ##Rate matrix is an estimated covariance matrix for ancestral node 28, based on the averages of living species (phylogeny tips) projection.rate_matrix.28.pc.raw <- as.matrix(aMeans_28_df[,-1])%*%rate_matrix.28.pc.raw$vectors log.rate_matrix.28.var.raw <- log(apply(projection.rate_matrix.28.pc.raw, 2, var))

lm.28.raw = lm(log.rate_matrix.28.var.raw ~ log.cov.28.var.raw) Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'y'

When I finish running lm, it gives an infinite value error, which is being generated in the log.rate_matrix.28.var.raw file: [1] 4.69864571 3.55438004 -0.07623461 -69.89008220 -68.62157088 -67.70528014 -67.31380128 -71.10647753 [9] -67.57644727 -67.84838099 -69.31471806 -67.08112583 -Inf -67.15523381 -66.14713553 -66.36699500 [17] -62.37837532

I've done it again, I've looked at the matrices, I've gone through the whole step by step and I haven't seen any strange values. I don't know what else it could be.

Run lm.28.raw = lm(log.rate_matrix.28.var.raw ~ log.cov.28.var.raw)

0

There are 0 best solutions below