ProcessMiner / nlcor

An implementation of an efficient heuristic to compute the nonlinear correlations between numeric vectors. The heuristic works by adaptively identifying multiple local regions of linear correlations to estimate the overall nonlinear correlation. The nonlinear correlations estimate has various applications in data exploration and variable selection for nonlinear models.
GNU General Public License v2.0
18 stars 1 forks source link

Error missing value where TRUE/FALSE needed #5

Closed luis-zapata-b closed 4 years ago

luis-zapata-b commented 4 years ago

Whenever i try to run the code:

nlcor(x1,y1,plot=T) i get this error:

Error in if (sign(segment.cor$cor[i - 1]) == sign(segment.cor$cor[i])) { : Error missing value where TRUE/FALSE needed

When i put plot=F, it works but this warning mantains: Warning message: In FindSegmentSize(l = length(x), refine = refine) : Refinement too high or data is small. Adjusting computation.

Please help, i really need the plots.

cran2367 commented 4 years ago

@luis-zapata-b Please try now. Run the following:

install.packages("devtools")
library(devtools)
install_github("ProcessMiner/nlcor")

library(nlcor)
library(ggplot2)

nonlinear.cor <- nlcor(x1, y1, plt = T)
print(nonlinear.cor$cor.plot)

Please let us know if the problem still exist.

Jinstats commented 4 years ago

I have a same problem as this.

cran2367 commented 4 years ago

@Jinstats @luis-zapata-b Please replace plot = T with plt = T. The argument name here is plt.

cran2367 commented 4 years ago

@Jinstats @luis-zapata-b please respond if the problem still exists. This issue will be otherwise closed in 5 days.

luis-zapata-b commented 4 years ago

I use plt, it must have been the autocorrector. I still have the same problem. Whenever it works with the x1 and y1 database, when i use my own data base (without NAs and both the same size), i keep getting the same error.

Please help

Jinstats commented 4 years ago

I exactly use the argument "plt=T", but still have the error.

cran2367 commented 4 years ago

@luis-zapata-b @Jinstats did it work with the default x1 and y1 available with the package for testing? If it did and it does not work for your data, please share it with us so that we can reproduce the error.

Jinstats commented 4 years ago

default x1 and y1 works. Attached please find the data I used. test.xlsx

cran2367 commented 4 years ago

@Jinstats Thank you for sharing the data. There was a bug that could not plot if the estimated relationship was linear. It is fixed and deployed. Please run it as:

install.packages("devtools")
library(devtools)
install_github("ProcessMiner/nlcor")

library(nlcor)
library(ggplot2)

data <- read.csv(file='test.csv', header = T)
nonlinear.cor <- nlcor(data$x1, data$y1, plt = T)
print(nonlinear.cor$cor.plot)

@luis-zapata-b Please try it. Hopefully this also solves your issue. If not, please let us know and share your data.

cran2367 commented 4 years ago

@Jinstats @luis-zapata-b when you install the nlcor package please remove your current version with remove.packages('nlcor') and install again. Make sure the nlcor version you have reinstalled is nlcor_1.1.0

Jinstats commented 4 years ago

Thanks so much. it works.

cran2367 commented 4 years ago

Great. Closing the issue.