0

I am trying to use ee.Reducer.linearFit() similar to as used in https://developers.google.com/earth-engine/reducers_regression between 'evi' calculated by me and time.

I observed that absolute values of 'scale' are very high (higher than 1). Since scale corresponds to te slope of the line, I expected the value of it to be in between -1 and +1.

What does high values of scale indicate? And why aren't the scale values a double or float?

Example code here https://code.earthengine.google.com/d5b329de1a86fed97ca9f53ca71d087c

  • 1
    A line closer to the y axis than the x axis has a slope with magnitude greater than 1. Could you add a short example program to your question that demonstrates the calculation you're making? This will help understand whether there's a mistake or how to interpret your particular result. – Kevin Reid Aug 6 at 14:14
0

I don't see anything unusual here. To explore the data values that are going in to the linear fit, I added a layer with the original values

Map.addLayer(statsCollection.select('mean').toBands());

and used the Inspector to look at example pixel values (select the Inspector tab next to Console and then click on a point on the map)

Pixels
    Layer 1: Image (5 bands)
        0_mean: 1400.75
        1_mean: 1481.75
        2_mean: 1865
        3_mean: 1138.25
        4_mean: 1148.75
    Slope of linear fit: Image (2 bands)
        slope: -84.75
        offset: 171584.9

From this we can see that the slope is not an integer. You were probably looking at the histogram chart's values — a histogram creates "buckets" of some width to count similar values, and in this case chooses integer representative values for those buckets.

The large slope value is not unreasonable, either: just look at the numbers. If we compare the end points it goes from 1400 to 1148, a difference of 242 on the y axis with a difference of 4 on the x axis, or a slope of 242/4 = 60.5 if we "linear fit" only those two points. You could take that number sequence and run the fit using another tool or on paper and I expect you'll get the same answer.

(You didn't ask, but the offset value is large because the data has a large offset in the x-axis: it goes from 2006 to 2010, not around zero! So we can generally expect the offset to be of the magnitude 2008 times the slope — 2008 × 84.75 = 170178, there we go.)

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.