3
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ 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." $\endgroup$
    – JimB
    Commented Jul 15, 2020 at 4:59
  • $\begingroup$ So, Predict performs worst than LinearModelFit? $\endgroup$
    – Las Des
    Commented Jul 15, 2020 at 6:05
  • $\begingroup$ 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. $\endgroup$
    – JimB
    Commented Jul 15, 2020 at 15:28

1 Answer 1

4
$\begingroup$
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 &
$\endgroup$
2
  • $\begingroup$ In the documentation page says that it has been discontinued. Can it be done with only Information? $\endgroup$
    – Las Des
    Commented Jul 15, 2020 at 3:28
  • $\begingroup$ @LasDes, please see the update. $\endgroup$
    – kglr
    Commented Jul 15, 2020 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.