I have got an issues with my Mann Kendall R script.
I'm getting wrong P value when I calculate based on the sum(Quantity) but it is give me an accurate P value based on the number of records.
Dataset %>% mutate(
MannKendallY = if (length(Total) > 0)
{MK <- MannKendall(TotalQuantity)
pvalue <- as.numeric(MK$s)} else{
pvalue <- 1}
) %>% mutate(
TauY = if (length(Total) > 0)
{MK <- MannKendall(Total)
tau <- as.numeric(MK$tau)} else{
tau <- 0}
)
Any inputs are appreciated.
Many Thanks.