-
Notifications
You must be signed in to change notification settings - Fork 29
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
raster.kendall function in spatialEco package #43
Comments
The problem you are having is a real error in relation to your data. You are not allowed to have missing values in the Mann-Kendall statistic. Raster-stack values with all NA's are accounted for in the function but, real time-series with missing values will throw an error. It also questionable deriving a temporal trend on fewer than 8 values (thumb-nail rule). I changed the default to a minimum of 3 but, this is very questionable practice at best.
You can try to fill missing values using a local polynomial regression the impute.loess<https://rdrr.io/cran/spatialEco/man/impute.loess.html>, which can also smooth the timeseries (which is also a common preprocessing step). However, you may not get satisfactory results with so few values. There is also an alternative smoothing function available "sg.smooth<https://rdrr.io/cran/spatialEco/man/sg.smooth.html>" that uses Savitzky-Golay convolution kernel smoothing.
Sincerely,
Jeffrey Evans
Jeffrey S. Evans, Ph.D., | Senior Landscape Ecologist & Biometrician
The Nature Conservancy | Global Protect, Science
Visiting Professor | University of Wyoming | Zoology & Physiology
Laramie, WY | ***@***.******@***.***> | (970) 672-6766<tel:(970)%20672-6766>
TNC Biography<https://www.nature.org/en-us/about-us/who-we-are/our-people/jeff-evans/> - Google Scholar<https://scholar.google.com/citations?user=FwU_ppgAAAAJ&hl=en>
From: Annoshe Kafash ***@***.***>
Sent: Monday, May 30, 2022 12:24 PM
To: jeffreyevans/spatialEco ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [jeffreyevans/spatialEco] raster.kendall function in spatialEco package (Issue #43)
I have 6 climate layer and stack them as a file. when I run "raster.kendall" function, I get an Error:
"Error in raster.kendall(x, p.value = TRUE, z.value = TRUE, intercept = TRUE, :
please install EnvStats package before running this function"
When I install "EnvStat" package, and run again "raster. kendall" function, I get another error:
"Error in (function (y, x = seq(along = y), alternative = "two.sided", : When ci.slope=TRUE, there must be at least 3 non-missing, finite observations"
-
Reply to this email directly, view it on GitHub<#43>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACLKH74BH4ZO7SZCMJLTLSDVMUBT3ANCNFSM5XLJMFBQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.******@***.***>>
|
I am closing this ticket as it is related to too few observations and missing data in your timeseries, which are not allowed. |
I have the same error, because I am computing sea surface temperature trend over a stack where on-land values are all NaN. I feel that the behaviour in this case (all NaN values in a pixel/cell) should be to return NA for that calculation, rather than fail with an error. If you disagree, how would you treat this in my example? |
I have 6 climate layer and stack them as a file. when I run "raster.kendall" function, I get an Error:
"Error in raster.kendall(x, p.value = TRUE, z.value = TRUE, intercept = TRUE, :
please install EnvStats package before running this function"
When I install "EnvStat" package, and run again "raster. kendall" function, I get another error:
"Error in (function (y, x = seq(along = y), alternative = "two.sided", : When ci.slope=TRUE, there must be at least 3 non-missing, finite observations"
The text was updated successfully, but these errors were encountered: