turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Find the AVERAGE of many SLOPE values

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-21-2016 03:36 AM - edited 08-21-2016 07:37 PM

I'm working with many simple linear regression outputs, particularly the 'slope' measures.

I'd like to AVERAGE various slope numbers. The question is, how to best do this.

The underlying model is a 5-day time series. Change each day. Regression line through the five points. Many runs at this. So, **each** number below represents the slope from the regression line, over a five-day period.

Example:

```
Slope
6.43782
5.98223
2.12001
1.62409
0.60793
2.17274
5.76630
1.82939
4.09485
0.20365
```

Mean of Slope above = 3.0839

I read that it might be better to use the 'angle' version of slope for averaging (and clustering, etc.).

To convert from slope m to slope angle and back:

angle = arctan(m)

m = tan(angle)

```
Arctangent
1.41670
1.40517
1.13005
1.01889
0.54623
1.13945
1.39908
1.07054
1.33128
0.20090
```

Mean of Arctangent above = 1.06583

Converting back to Slope... Tangent(1.06583) = 1.80908

Totally different from 3.0839.

Anyone here care to comment? How to average slopes??

Thanks for your guidance.

Nicholas Kormanik

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NicholasKormanik

08-21-2016 09:28 AM

maybe you miss conversions of slope from degrees to radians, before computing the average,

and at last convert radians to degrees ?

Shmuel

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NicholasKormanik

08-21-2016 04:25 PM

Impossible to answer without context. What are the units of those slopes? Transforming slopes to angles can make sense, but only for unitless slopes.

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

08-21-2016 07:39 PM

Thanks. I've added this information to the original question.

Does that help?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NicholasKormanik

08-21-2016 10:36 PM

Yes, it does help. Obviously the X and Y units of your slopes are not the same. Here is why I asked about units.

Let's assume that the slopes are expressed in dollars per day. Suppose a colleague of yours wants to replicate your calculations, but that she prefers to express the amounts in yens per day. No problem, she multiplies everything by 113.62 (today's exchange rate). After arcTan - Mean - Tan operations, she gets an average slope of 121.04 yens per day. But your estimate of average slope is 1.809*113.62 = 205.54 yens per day!

I would avoid any estimator that is inconsistent in this way.

PG

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to NicholasKormanik

08-22-2016 09:17 AM

As PGStats points out, the trick is to scale the data so that you can compare distances in the x and y directions.

This is usually accomplished by dividing the X data by the range(X) and the Y data by range(Y).

There are many methods in the literature for computing average (or median) slopes, or for using the angles (often called orientations), for time series. You can read the article "Banking to 45: Aspect ratios for time series plots" for some of the ideas and formulas. In general, you should not expect the orientation method to give the same answer as the slope method because arctan is a nonlinear transformation.

What question are you trying to answer with this analysis? Why do you want to compute the average slope or orientation?