Branched from: https://community.esri.com/thread/199323-re-trend-analysis-through-time-series-of-raster-data
Hi Xander Bakker, Some modification I want to do in correlation script.
I Would like to calculate the P value as a raster in addition to correlation raster.
Using scipy library, I just ran one script to obtain the correlation and P value. Script is attached below
import numpy as np
from scipy.stats import pearsonr
x = np.array([ 58295.62187335, 45420.95483714, 3398.64920064, 977.22166306, 5515.32801851, 14184.57621022, 16027.2803392 , 15313.01865824, 6443.2448182 ])
y = np.array([ 143547.79123381, 22996.69597427, 2591.56411049, 661.93115277, 8826.96549102, 17735.13549851, 11629.13003263, 14438.33177173, 6997.89334741])
r,p = pearsonr(x,y)
print "r", r
print "p", p
Output
Returns: | r : 0.831087956392
p-value : 0.00550539621039
|
---|
So instead of Numpy, can we use here Numpy and Scipy both library to get the addition p value or in the existing script can we add this function to obtain the p Value as a raster
Thanks & regards
Shouvik Jha
Solved! Go to Solution.
Sorry, Earlier the option had disabled to mark it correct, that's why I could not able to mark it. Now the option is functioning, hence I marked it correct.
Thanks & regards
Shouvik Jha
How did you calculate the (statistical not raster) correlation using script. I don't need output in raster format but i need r and p value. I also have time series data of two different variables (ndvi and rainfall). Please if you can guide me. Shouvik Jha Xander Bakker