I have some time series data where the measured variable is discrete positive integers (counts). I want to test if there is an upward trend over time (or not). The independent variable (x) is in the range 0-500 and the dependent variable (y) is in the the range 0-8.

I thought that I answer this by fitting a regression of the form `y = floor(a*x + b)` using ordinary least squares (OLS).

How would I go about doing this using R (or Python)? Is there an existing package for it, or am I better off writing my own algorithm?

PS: I know this is not the ideal technique, but I need to do a relatively simple analysis that I can actually understand - my background is biology not maths. I know I am violating assumptions about error in measured variable, and independence of measurements over time.