laresbernardo / lares

Analytics & Machine Learning R Sidekick
https://laresbernardo.github.io/lares/
233 stars 49 forks source link

Error en corr_var #32

Closed BaltiBoix closed 3 years ago

BaltiBoix commented 3 years ago

image

laresbernardo commented 3 years ago

Hi @BaltiBoix I guess this is not an error on the code but what's happening is that there is no correlation with less than 0.05 as pvalue. I will pass a friendlier "error" message when this happens so the user understands what happened. Reproducible example:

library(lares)
library(tidyverse)
A <- tibble(x=1:4,y=c(0,1,2,7),z=c(5,9,7,3))
corr_var(A, x)
corr_var(A, x, max_pvalue = 0.05)
laresbernardo commented 3 years ago

Ok, now you'll get:

> corr_var(A, x, max_pvalue = 0.05)
[1] variables corr      pvalue   
<0 rows> (or 0-length row.names)
Warning message:
In corr_var(A, x, max_pvalue = 0.05) :
  There are not enough observations to plot. Check your 'max_pvalue' input
BaltiBoix commented 3 years ago

Using max_pvalue=0.99 gives the same error.

Thanks

Balti

El vie, 23 abr 2021 a las 14:27, laresbernardo @.***>) escribió:

Hi @BaltiBoix https://github.com/BaltiBoix I guess this is not an error on the code but what's happening is that there is no correlation with less than 0.05 as pvalue. I will pass a friendlier "error" message when this happens so the user understands what happened. Reproducible example:

library(lares) library(tidyverse) A <- tibble(x=1:4,y=c(0,1,2,7),z=c(5,9,7,3)) corr_var(A, x) corr_var(A, x, max_pvalue = 0.05)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/laresbernardo/lares/issues/32#issuecomment-825623064, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADH7LDCDUEUGXV4YPTTNTFTTKFRSVANCNFSM43OI5FEA .

laresbernardo commented 3 years ago

That's correct, because the pvalue for each variable is 1:

> corr_var(A, x, plot = FALSE)
  variables    corr pvalue
2         y  0.9135      1
3         z -0.4000      1
BaltiBoix commented 3 years ago

Sorry, I think that I have misinterpreted the pvalue. I thought it was referred to the null hypothesis of corr=0.

Thank you, your package is very useful!

Balti

El vie, 23 abr 2021 a las 15:39, laresbernardo @.***>) escribió:

That's correct, because the pvalue for each variable is 1:

corr_var(A, x, plot = FALSE) variables corr pvalue 2 y 0.9135 1 3 z -0.4000 1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/laresbernardo/lares/issues/32#issuecomment-825665060, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADH7LDHUNTAQB4WLO2SSSJLTKFZ7JANCNFSM43OI5FEA .