I have a table containing data for many people over many months. To simplify it assume that preprocessing can give me a table of PersonID, MonthNumber, Value.
I want to calculate the linear regression for each person's values over the months available.
Essentially the question I want to answer is
'In general, are this persons values getting better, getting worse or staying the same as time passes.'
One way to do this would be to calculate the slope of the linear regression for each person over the months I have available and determine if this slope is negative, positive or zero (or close to zero).
Does anyone have any idea how I might go about calculating the slope of the linear regression in SQLlite from a table such as I describe?
ideally the result of the query would be a table giving PersonID, Slope, Intercept
or, better still PersonID, MonthNumber, Slope, Intercept
so that I can see whether they are getting better, worse or the same at each month in time.
Aucun commentaire:
Enregistrer un commentaire