# Fitted equation with Predict

Is there a way to know the fitted curved from the function Predict when choosing the linear regression method.

I am using this data:

SeedRandom[144]
x = 2*RandomReal[{0, 1}, 10];
y = 2 + 2*x + RandomReal[{0, 1}, 10];


I am asking beacuse I use LinearFitModel in order to get the equation of the best fit.

• If the error term is a uniform distribution (rather than something more closely related to a normal distribution), then while the parameter estimates are probably unbiased, you won't be able to justify the use of any of the measures of precision (95% confidence bands, standard errors of parameters, etc.). A fit is more than just the estimation of the parameters: it also includes checking assumptions about the error structure. This is why Machine Learning is many times thought of as "Statistics without the worry of checking on assumptions." – JimB Jul 15 at 4:59
• So, Predict performs worst than LinearModelFit? – Las Des Jul 15 at 6:05
• No. Predict performs identical to LinearModelFit when it comes to the estimates of the coefficients. But when you start out with a uniform distribution for the error, LinearModelFit does not give appropriate estimates of precision and Predict doesn't give estimates of precision at all. Maybe you were just using RandomReal to get an example dataset as opposed to mimicking the kind of data you actually have. – JimB Jul 15 at 15:28

## 1 Answer

p = Predict[x -> y, Method -> "LinearRegression"]


In versions 12.+, you can use the functions Information or PredictorInformation:

Information[p, "Function"]

2.32989 + 2.1804 #1 &

PredictorInformation[p, "Function"]

2.32989 + 2.1804 #1 &


In version 11.0, you can use PredictorInformation

PredictorInformation[p, "Function"]

  2.54578 + 1.9879 #1 &

• In the documentation page says that it has been discontinued. Can it be done with only Information? – Las Des Jul 15 at 3:28
• @LasDes, please see the update. – kglr Jul 15 at 3:46