I have a dataset where temperature rise is a function of rising in r, t, y, u (e.g. axial force, acceleration and etc.). Here I am interested to see the relationship between the rise in temperature and one of these variables while removing the effect of the other variables. I have the following code which plots the linear regression of the relationship and compares it to the measured temperature:
PredTemp <- lm(temp ~ r + t + y + u, data=dataset)
summary(PredTemp)
coefficients(PredTemp) # model coefficients
plot(PredTemp)
##plotting time vs predicted temperature (multiplying the variables by their coefficient)
plot(x, 509.7376009+(-1588.6602112* r)+ (-1611.5355383 * t)+ (0.2760947 * y) + (-224.9113169 * u), type="l")
lines(x, temperature, type="l", col="red")
par(new=TRUE)
Red line: original
Black line: predicted relationship
However, I am not sure if this is the best approach towards identifying/removing the effect of these variables from the temperature rise.
Is there a way to find the best optimisation match for this equation by minimising the difference between the measured and predicted values? Maybe by using a polynomial function instead of linear?