Hi friends, Any idea why do i get this warning?And also why all computed p-values are NaN. Have shown below what i did in Windows r-console.:-- > df c1 c2 1 1 50 2 NA NA 3 4 NA 4 7 6 5 NA 7 6 10 10 > r<-cor(x=df,y=NULL,use="complete.obs",method=c("pearson")) > r c1 c2 c1 1.0000000 -0.9148074 c2 -0.9148074 1.0000000 > cor.p.values<- function(r, n) + { + df <- n - 2 + ESTIMATE <- c(cor = r) + PARAMETER <- c(df = df) + STATISTIC <- c(sqrt(df) * r / sqrt(1 - r^2)) + p <- pt(STATISTIC, df) + return(2 * pmin(p, 1 - p)) + } > cor.p.values(r,2) [1] NaN NaN NaN NaN *Warning message: In pt(q, df, lower.tail, log.p) : NaNs produced * Any help will be appreciated.. :) -- Thanks Moumita
[[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.