Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running promotion impact #7

Open
jmdiaz77 opened this issue Apr 12, 2023 · 1 comment
Open

Error when running promotion impact #7

jmdiaz77 opened this issue Apr 12, 2023 · 1 comment

Comments

@jmdiaz77
Copy link

Hello,

I'm really interested in using your function to calculate the promotion impact of my company sales, I'm getting this error though:

Error in rlbin(x, y, gpoints, truncate) :
NA/NaN/Inf in foreign function call (arg 2)

This is the data set structure I'm using (data is simulated for confidentiality purposes): (sim_data)

"date" "Value"
"2021-01-03" 3186901.17013079
"2021-01-10" 3265640.43217725
"2021-01-17" 3268149.24855909
"2021-01-24" 3379581.96053066
"2021-01-31" 3093308.44756577
"2021-02-07" 3179393.55724866
"2021-02-14" 3013127.51454619
"2021-02-21" 3102475.23578647
"2021-02-28" 3039912.27776832
"2021-03-07" 3146891.29327893
"2021-03-14" 3183255.29924492
"2021-03-21" 3154212.3190161
"2021-03-28" 3182135.05831708
"2021-04-04" 2973922.08664931
"2021-04-11" 3078445.82336988
"2021-04-18" 3454091.01263552
"2021-04-25" 3407805.20723486
"2021-05-02" 3420337.94147393
"2021-05-09" 3444782.12344737
"2021-05-16" 3490138.70348411
"2021-05-23" 3149032.17281802
"2021-05-30" 2946737.71786502
"2021-06-06" 3091284.09392359
"2021-06-13" 3167635.6939588
"2021-06-20" 3554833.59780139
"2021-06-27" 3023377.21786782
"2021-07-04" 2935482.34281247
"2021-07-11" 3431121.72865115
"2021-07-18" 2995313.407996
"2021-07-25" 3198884.74266002
"2021-08-01" 3078361.83238697
"2021-08-08" 2963133.11363214
"2021-08-15" 3431733.65260153
"2021-08-22" 3426277.71411886
"2021-08-29" 3188153.32998263
"2021-09-05" 3266239.11904765
"2021-09-12" 3502535.5264718
"2021-09-19" 3063294.75102668
"2021-09-26" 2781807.66608285
"2021-10-03" 3171200.78495692
"2021-10-10" 2720833.95253174
"2021-10-17" 3666641.67034585
"2021-10-24" 3268155.36040834
"2021-10-31" 2953225.54460881
"2021-11-07" 3027676.8364909
"2021-11-14" 3410037.08607516
"2021-11-21" 3121786.51549821
"2021-11-28" 2896399.15101311
"2021-12-05" 3306732.67231853
"2021-12-12" 3491670.9230058
"2021-12-19" 3390675.93191126
"2021-12-26" 3374390.34572636
"2022-01-02" 3387001.61064746
"2022-01-09" 3058441.73810686
"2022-01-16" 3075482.33071749
"2022-01-23" 3097800.53384865
"2022-01-30" 3507193.30354709
"2022-02-06" 3079066.94291169
"2022-02-13" 3312644.14191822
"2022-02-20" 3214351.93662292
"2022-02-27" 3034172.29620583
"2022-03-06" 3190251.13303379
"2022-03-13" 3306207.90277863
"2022-03-20" 3170817.49420472
"2022-03-27" 2994481.90676482
"2022-04-03" 3152910.35836313
"2022-04-10" 3319449.68822052
"2022-04-17" 3705520.14331667
"2022-04-24" 3124299.6656391
"2022-05-01" 3051469.73119217
"2022-05-08" 3231694.63245863
"2022-05-15" 3261949.40145483
"2022-05-22" 3333186.44354397
"2022-05-29" 3158307.17786835
"2022-06-05" 2967652.89247366
"2022-06-12" 3349452.50015576
"2022-06-19" 3270670.85805369
"2022-06-26" 2890241.50362667
"2022-07-03" 3164110.23304554
"2022-07-10" 3442187.84503933
"2022-07-17" 3092901.38831951
"2022-07-24" 3455373.98058699
"2022-07-31" 3225733.04503835
"2022-08-07" 2958199.95564822
"2022-08-14" 3336572.46846206
"2022-08-21" 3247896.14610339
"2022-08-28" 3650056.42908058
"2022-09-04" 3270352.4000488
"2022-09-11" 3034819.25977034
"2022-09-18" 3281570.6537897
"2022-09-25" 3195464.87359245
"2022-10-02" 3265458.83856642
"2022-10-09" 3040092.25868474
"2022-10-16" 3349513.36096732
"2022-10-23" 3322362.95983851
"2022-10-30" 3414841.78133749
"2022-11-06" 3478827.87375997
"2022-11-13" 3133038.32385223
"2022-11-20" 3185989.41936622
"2022-11-27" 3398335.34390337
"2022-12-04" 3324007.22603618
"2022-12-11" 3205447.03705312
"2022-12-18" 3458745.19787775
"2022-12-25" 3371461.88833331
"2023-01-01" 3163107.74106541
"2023-01-08" 3242727.86632233
"2023-01-15" 3442979.05307492
"2023-01-22" 3402762.37383945
"2023-01-29" 3149894.28937906
"2023-02-05" 2980394.7024286
"2023-02-12" 3359106.3115865
"2023-02-19" 2861208.08789385
"2023-02-26" 3358338.75171958

And my promotion table (sim_promotion):

"pro_id" "start_dt" "end_dt" "tag_info"
"pro_1_1" "2021-01-10" "2021-03-07" "B"
"pro_2_1" "2021-04-11" "2021-05-16" "A"
"pro_2_2" "2021-12-05" "2022-02-13" "A"
"pro_1_2" "2022-05-01" "2022-07-10" "B"
"pro_1_3" "2022-10-09" "2022-10-23" "B"
"pro_2_3" "2022-11-13" "2022-11-20" "A"
"pro_3_1" "2023-02-05" "2023-02-26" "C"

The line of code that is giving the error with this tables is this one:

pri1 <- promotionImpact(data=sim_data, promotion=sim_promotion,
time.field = 'date', target.field = 'Value',
trend = T, period = 30.5, trend.param = 0.02, period.param = 2,
logged = T, differencing = T, synergy.promotion = FALSE,
synergy.var = NULL, allow.missing = T)

I tried checking the class of the variables in the tables but everything is as it should be (date, double and character for tag_info and pro_id.

Hope you can help me out!

Regards,
Jama

@Juli-2023
Copy link

I have the same problem trying to run the code; did you ever get your error resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants