# Timeseries - How are the window/span size and 'frac' in LOWESS related?

Many software implementations of locally weighted scatterplot smoothing (LOWESS), such as those in Python and R, require a frac parameter as an input. I am confused as to how frac is mathematically related to the term 'window size'.

According to Statsmodels' documentation,

The algorithm works by estimating the smooth y_i by taking the frac*N closest points to (x_i, y_i) based on their x values and estimating y_i using a weighted linear regression.

The term 'window size' or 'span size' is often used to describe the span of data about which the locally weighted regression is performed. However, I found that while 0 < frac < 1, window sizes/widths are generally specified as > 1. For example:

Therefore in this work, we set the window width [of the] filter to 20.

In the context of time series analysis, what is the mathematical relationship between frac and window size?

• I would have thought both would lead to a particular number of points being used for the local calculation, and this might with be stated either as the window or as a fraction of the total data. Commented Dec 14, 2022 at 14:57
• The answer is contained entirely within your question. "frac" represents a fraction of the points, for which the width of the interval to contain them will depend on the local density (high density $\implies$ narrow interval to get the requited fraction of the points, low density $\implies$ wide interval), while normally a window width will be expressed in data units and may cover a varying fraction. Commented Dec 14, 2022 at 17:08
• Thanks for the responses. @Glen_b, if I understood correctly, does this necessarily imply that frac = 1/(window_size), i.e., a window size of 20 corresponds to a frac of 1/20? Commented Dec 15, 2022 at 4:15
• Not if I am understanding it correctly, no. Consider a variable $X$ with support on (0,300), but where (0,50) has half of the total the probability (uniformly on that interval) and [50,300) has the remaining half of the probability (also uniformly). Then a window of width 20 will have a higher frac within that first section than than if it was in the later section. Commented Dec 15, 2022 at 6:04
• If we define the window size as the number of data points considered in a moving/stationary window, my initial intuition suggested that frac = window_size/total_number_of_data_points. But I guess this doesn't explain the variation of frac with probability distribution/density. Commented Dec 15, 2022 at 18:20