I am converting a high-dimensional model to a lower dimensional model by fitting a sliding window of it to a linear (parametric) model and looking at the evolution of parameter values over time. I'm going from 6.3 million points to about 2500 values of 6 parameters.
Physics says the intercept should be a constant value, but when I use LM it moves around. I think the motion is because of noise, and that it causes other parameter values not to indicate properly. I would like to set it to a known constant value.
How do I make a linear model in R that has a prescribed intercept (not zero).
Current code:
for (i in 1:(n-k)){
fit <- lm(y ~ x1 + x2 + I(x3^2) + x4 + x5 + x6 , data=data[i:(i+k),])
#STORE PARAMETERS INTO VARIABLES
... #truncated for brevity
}
Code that doesn't do the job:
fit <- lm(y ~ I(9.81) + x1 + x2 + I(x3^2) + x4 + x5 + x6 , data=data[i:(i+k),])
fit <- lm(y ~ 9.81 + x1 + x2 + I(x3^2) + x4 + x5 + x6 , data=data[i:(i+k),])
Question:
- How do I prescribe the constant?
- I tried searching for this both at google and CV - is there a vocabulary that I am missing?
- Can you comment on how something like AIC or R2 are impacted by this model? I prefer to use AIC or BIC and I think that, as model selection criteria they should account for parameters, but the R2 changes (I think) in a fundamental way between the two.
- I tried searching in CV for an answer to this question, but did not find it. One alternate solution was suggested but its form is substantially different than what was requested. It is about massaging the inputs, not about formatting the command without fundamentally altering the data. The answer that I liked (and found most useful) is about the form of the formula entered, not about creating new variables.
As usual, comments and suggestions are solicited.