bluefoxr / COINr

COINr
https://bluefoxr.github.io/COINr/
Other
25 stars 8 forks source link

Box-Cox transformation impossible with panel data #48

Closed MoujibChahid closed 1 year ago

MoujibChahid commented 1 year ago

The Box-Cox transformation is impossible with panel data. I've set up the Coin and the data is correctly written to .$Data$Raw

Here's the script I used:

library(COINr) coin <- new_coin(iData = iData, iMeta = iMeta) iData checked and OK. iMeta checked and OK. Error in new_coin(iData = iData, iMeta = iMeta) : Panel data detected, but you have not specifed split_to - please specify this. coin <- new_coin(iData = iData, iMeta = iMeta, split_to = "all") iData checked and OK. iMeta checked and OK. Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw Written data set to .$Data$Raw

After several attempts, I get the following error message, given that all the data in the dataset is numeric. Error in boxcox(coin, lambda = 0, makepos = TRUE, na.rm = FALSE) : is.numeric(x) is not TRUE

Here is the script used to obtain the Box-Cox transformation: boxcox(coin, lambda = 0, makepos = TRUE, na.rm = FALSE)

In addition, the COINr documentation does not offer and/or specify the possibility of performing a Box-Cox transformation for a single indicator (dataframe).

I would like to thank you in advance for your usual cooperation and ask you to remedy this situation, which is preventing me from carrying out a transformation. If the problem is solved, an example from you would be very helpful.

bluefoxr commented 1 year ago

Hi please check the documentation for boxcox(). It is not intended to be used on coins, purses or data frames but only on numeric vectors. It was intended for use in data treatment as an accessory function but has never really been used. I don't have time to work this into the package more thoroughly at the moment with examples.