# How to deal with unevenly spaced time data in time series linear regression

I have a dataset that has a number of instances that look like the following:

id        x                y
a         2015-05-04       1
18:32:00
a         2015-05-04       1
18:32:00
a         2015-05-04       1.5
18:32:00
a         2015-05-05       4
16:30:00
a         2015-05-08       5
10:25:00
a         2015-05-10       6
00:32:00
a         2015-05-11       7
6:45:00


"id" is an identification variable, of which there are thousands in the data set, and I'm running various forms of linear regressions to predict the dependent variable ("y") over time ("x") within each identification value. Note that for the actual regression, "x" is converted to an integer corresponding to the number of days since the beginning of the data under that identification value.

The issue I'm having relates to the uneven nature of the time element of the regression (the "x"). In this example data set, each observation in an OLS regression would be given equal weight, regardless of when the observation occurred in time. However, I feel that this would cause issues with the predictive power of my model if it gives equal weight to 3 observations that happened at the same time, and then as a result less weight to other observations in time (as more recent observations should have more weight in the regression). This is especially relevant because its possible that the first 3 observations were given that time because of an error in uploading data to our database, and hence were given the same time as soon as they could be uploaded to the database (however, there's no way for me to check whether this actually occurred).

Is there a way to assign, within a regression, each observation within a day a weight of 1/count(observations in that day)? So that if one day has 3 observations, each observation within that day is given 1/3 weight in the regression, and one day corresponds to a weight of 1/count(unique days in data set)?

Or if this isn't the best way of dealing with this issue, what would you suggest I look into to help with this problem to smooth out the time element of the data?

Or, even from a theoretical perspective, is this a problem?

I would appreciate any thoughts and feedback and am happy to answer any questions you may have.

Yes, you can easily weight observations. If you are using R, in function lm you have an argument weights to that effect (alternatively, argument wt of function lsfit).