0
$\begingroup$

I am trying to run a Mann Kendall test on community dissimilarity for streams sampled roughly monthly, but with NA values for some months where conditions prevented data collection. From what I am reading, the Mann Kendall test should be able to handle these missing values, but I am getting the following error.

> mk.test(dissim.avg.ts,alternative="greater", continuity=F)
Error in na.fail.default(x) : missing values in object

Can anyone explain to me what is causing the problem here and how to address it?

$\endgroup$
  • $\begingroup$ I cannot find the source of your claim should be able to handle these missing values, are you sure this is true? Have you tried manually removing the missing values? $\endgroup$ – user2974951 Dec 20 '18 at 6:36
  • $\begingroup$ There shouldn't be any issue making the calculations in general, although the performance of the test will suffer with increasing numbers of missing values. The following link is where I had read about the specific tests in R, but on closer inspection, it's not clear if that part of the text refers to the trend or kendall package. However, it's a time series data set, so when I remove the values before creating the time series, it bumps data points up to fill in the gaps. $\endgroup$ – Avery Scherer Dec 21 '18 at 18:39
0
$\begingroup$

Yes, the Mann-Kendall test does allow missing values (see Gilbert 1987); however, documentation for the R mk.test function indicates that the current version is for complete observations only (https://www.rdocumentation.org/packages/trend/versions/1.1.1/topics/mk.test). Try the MannKendall function in the Kendall package.

$\endgroup$
  • $\begingroup$ Shoot, I just realized the source I had read that in references both packages and it isn't clear which they are referring to when they make that statement. I'll try the other package, thanks! $\endgroup$ – Avery Scherer Dec 21 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.