trend

How compute trend using awk?

人走茶凉 提交于 2019-12-11 08:38:57
问题 I have a time series of temperature data as: ifile.txt 1921 25 1922 25.1 1923 24.2 1924 23.4 1925 24.4 1926 25.1 1927 23.6 1928 25.2 1929 23.9 1930 25.6 I would like to compute the trend for the period 1923-1929. My algorithm to do it is: Fit the above points to a line such as Y = mX + c ; where m is the trend I could find the trend for whole period, but I can't able to modify my script when selecting for a specific period. Would you please check my script? awk '/1923/,/1929/ {if (NR==FNR) x

MySQL slope (trend) of single field (line of best fit)

流过昼夜 提交于 2019-12-11 03:18:40
问题 I have a simple table called LOGENTRY with fields called "DATE" and "COST". Example: +--------------+-------+ | DATE | COST | +--------------+-------+ | MAY 1 2013 | 0.8 | | SEP 1 2013 | 0.4 | | NOV 1 2013 | 0.6 | | DEC 1 2013 | 0.2 | +--------------+-------+ I would like to find the slope of the COST field over time (a range of rows selected), resulting in SLOPE=-0.00216 (This is equivalent to Excel's SLOPE function, aka linear regression). Is there a simple way to SELECT the slope of COST?

Is there a linear trend in data?

流过昼夜 提交于 2019-12-11 01:53:50
问题 I am having a continuously incoming data represented by an array of integer x = [x1,...,xn], n<1 000 000 . Each two elements satisfy the following condition x[i] < x[i + 1] . I need to detected as fast as possible such a breakpoint, where the linear trend of these data ends and transforms into a quadratic trend. The data always starts with linear trend... I tried to compute k = (x[i+1] - x[i])/ (x[i] - x[i-1]) But this test not too reliable... Maybe there is a more simple and efficent

Mysql query to get trend of temperature

一曲冷凌霜 提交于 2019-12-08 13:22:23
问题 I have a very large table where I have temperatures getting logged every 1 mins, what I would like to query is a trend; something like a percentage increase or percentage decrease per selected period ( hour or 15mins; depending on the query) my table looks (example) like the following ID time temp 119950 2013-03-27 07:56:05 27.25 119951 2013-03-27 07:57:05 27.50 119952 2013-03-27 07:58:05 27.60 119953 2013-03-27 07:59:05 27.80 119954 2013-03-27 08:00:05 27.70 119955 2013-03-27 08:01:05 27.50

Detect major events in signal data?

淺唱寂寞╮ 提交于 2019-12-05 06:55:33
问题 If I have a signal as the one below, how would I go about finding the beginning and end of the two "major events" (illustrated by a green arrow where the event begins, and a red arrow where it ends)? I've tried the method suggested in this answer, but it seems that no matter how much I play around with the lag , threshold and influence variables, it either reacts to the tiny changes in the beginning, middle and end of the graph (where there are no major events), or it doesn't react at all. I

Identifying trend with SQL query

爷,独闯天下 提交于 2019-12-04 20:07:25
问题 I have a table (let's call it Data) with a set of object IDs, numeric values and dates. I would like to identify the objects whose values had a positive trend over the last X minutes (say, an hour). Example data: entity_id | value | date 1234 | 15 | 2014-01-02 11:30:00 5689 | 21 | 2014-01-02 11:31:00 1234 | 16 | 2014-01-02 11:31:00 I tried looking at similar questions, but didnt find anything that helps unfortunately... 回答1: You inspired me to go and implement linear regression in SQL Server.

How to calculate and plot multiple linear trends for a time series?

99封情书 提交于 2019-12-04 19:30:01
Fitting a linear trend to a set of data is straight forward. But how can I fit multiple trend lines to one time series? I define up and down trends as prices above or below a exponential moving average. When the price is above the EMA I need to fit a positive trend and when the trend turns negative a new negative trend line and so forth. In my code below the market_data['Signal'] in my pandas dataframe tells me if the trend is up +1 or down -1. I'm guessing I need some kind of a loop, but I cannot work out the logic... import pandas as pd import pandas_datareader.data as web import datetime as

error in stl .series is not periodic

梦想与她 提交于 2019-12-04 16:11:07
I am pretty sure I am missing something which is very simple but still not able to figure out why this error is showing up . The data I have is of every month end data from 2013 Apr to 2014 Mar. Now I want to understand the trend over the 12 months period . xx <- structure(c(41.52, 41.52, 41.52, 41.68, 41.68, 41.68, 41.84, 41.84, 41.84, 42.05, 42.05, 42.05), .Tsp = c(2013.25, 2014.16666666667, 12), class = "ts"); is my time series data . Now when I use stl(xx,s.window ="periodic") I get error : Error in stl(xx, s.window = "periodic") : series is not periodic or has less than two periods i am

Detect major events in signal data?

女生的网名这么多〃 提交于 2019-12-03 21:45:57
If I have a signal as the one below, how would I go about finding the beginning and end of the two "major events" (illustrated by a green arrow where the event begins, and a red arrow where it ends)? I've tried the method suggested in this answer , but it seems that no matter how much I play around with the lag , threshold and influence variables, it either reacts to the tiny changes in the beginning, middle and end of the graph (where there are no major events), or it doesn't react at all. I can't simply determine if the signal is above a fixed threshold, as the strength of the signal can

Calculating length of 95%-CI using dplyr

断了今生、忘了曾经 提交于 2019-12-03 12:25:22
问题 Last time I asked how it was possible to calculate the average score per measurement occasion (week) for a variable (procras) that has been measured repeatedly for multiple respondents. So my (simplified) dataset in long format looks for example like the following (here two students, and 5 time points, no grouping variable): studentID week procras 1 0 1.4 1 6 1.2 1 16 1.6 1 28 NA 1 40 3.8 2 0 1.4 2 6 1.8 2 16 2.0 2 28 2.5 2 40 2.8 Using dplyr I would get the average score per measurement