Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Bart Smissaert
Sorry, I forgot to tell that. It is date column with an integer number. ID xValue xDate 1 130 40123 1 120 41232 1 140 40582 1 100 40888 1 110 42541 2 140 41225 2 130 41589 2 150 40872 RBS On Sat, Oct 12, 2019 at 3:18 PM

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Bart Smissaert
This is not a sample, but all the systolic blood pressure values of all of our patients. All this has to do with the calculation of the QRisk3 score: https://qrisk.org/three/ RBS On Sat, Oct 12, 2019 at 5:34 PM Richard Damon wrote: > One thing to point out, it sounds like you are dealing with

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Richard Damon
On 10/12/19 11:23 AM, Richard Damon wrote: > On 10/12/19 10:08 AM, Bart Smissaert wrote: >> How do I get the standard deviation of the last 4 entries (there could be >> less than 4) of an integer column grouped by an integer ID entry in another >> column in the same table. >> >> So data could be

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Bart Smissaert
Thanks, I do know how to calculate the SD in code, but I thought in this particular case it might be faster to do this in SQL. Only problem is the square root and for that reason I will test this in code as well and see how it compares with SQL. I found a way to get the one from last step, so

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Richard Damon
One thing to point out, it sounds like you are dealing with a sample, and I think you want to get the estimated standard deviation of the process, which says you really want to use the adjusted formula that uses N-1 in the denominator, as the expected value of the standard deviation of a sample is

[sqlite] Standard deviation last x entries

2019-10-12 Thread Bart Smissaert
How do I get the standard deviation of the last 4 entries (there could be less than 4) of an integer column grouped by an integer ID entry in another column in the same table. So data could be like this: ID xValue 1 130 1 120 1 140 1 100 1 110 2 140 2 130 2 150

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Igor Tandetnik
On 10/12/2019 10:08 AM, Bart Smissaert wrote: How do I get the standard deviation of the last 4 entries (there could be less than 4) of an integer column grouped by an integer ID entry in another column in the same table. What do you mean by "last 4 entries"? What determines the order? How

[sqlite] /

2019-10-12 Thread Richard Damon
On 10/12/19 10:08 AM, Bart Smissaert wrote: > How do I get the standard deviation of the last 4 entries (there could be > less than 4) of an integer column grouped by an integer ID entry in another > column in the same table. > > So data could be like this: > > ID xValue > > 1

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Keith Medcalf
The Standard Deviation of the Population is the Square Root of the mean of the second order differences. For your input values, you calculate the mean. Then you calculate the mean of the square of the difference between each value and the mean of the values. Then you take the square root of

Re: [sqlite] Standard deviation last x entries

2019-10-12 Thread Keith Medcalf
#!python3 from __future__ import absolute_import, division, print_function, unicode_literals import apsw db = apsw.Connection() db.executescript(""" create table x ( value integer not null ); insert into x values (120), (130), (140), (110); """) # Method 1: Using partial Running calc

Re: [sqlite] insertion of a single record taking more than 200 msec some times

2019-10-12 Thread Jens Alfke
> On Oct 11, 2019, at 7:43 AM, GopiKrishna Parisa > wrote: > > One weird thing is for some insertions, it's taking more than 200 msec for > single record where as others takes around 20 to 40 (avag 27 msec). Those sound like numbers I’d expect for committing a transaction. (The longer time

Re: [sqlite] rationale for private archives of the SQLite mailing list and suppressed reply-to

2019-10-12 Thread Jens Alfke
> On Oct 11, 2019, at 9:19 AM, Mike Bayer wrote: > > GNU Mailman is still very widely used and IMO does the job very well Its web interface is like something from 1997. In particular, it makes reading archives very painful, clicking through to one message at a time. I’d recommend groups.io —