I have a large data set with 150k lines and two data columns. I noticed that there is a linear trend, which I want to remove. So, I do the following:
first fit with a linear model
model = LinearModelFit[data, x, x]
then, I substract the fit from the data
data1 = data; data1[[All, 2]] = data[[All, 2]] - model[data[[All, 1]]] + model;
This, however, takes unacceptable amount of time. Is there any way I can speed things up.