clear data = xlsread('D:\Program Files\RStudio\cars.xlsx'); x = data(:, 1); y = data(:, 2); tb = table(x, y, 'VariableNames', {'speed', 'dist'}); model = fitlm(tb, 'dist~speed'); plot(model);
model里含有模型的各种参数,估计值,R2值,p值等等等等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
model =
Linear regression model: dist ~ 1 + speed
Estimated Coefficients: Estimate SE tStat pValue ________ _______ _______ __________