force slope in fitlm
4 views (last 30 days)
Show older comments
I'd like to use a linear regression, but to force the slope to take a fixed (=predefined) value. How is this possible using fitlm?
Backround:
I use a qqplot to check for normality of the residuals. In addition, I'd like to include a 95% confidence interval. One way to obtain the confidence interval is to fit a linear rgeression line and let matlab to the work:
mdl = fitlm(X,Y);
[ypred,yci] = predict(mdl,X);
Unfortunately, the linear regression line uses all the data to obtain an estimate for the slope. If outliers are present, the slope of the linear regression is not robust. Therefore, I'd like to determine a robust estimate of the slope in advance (e.g. using the first and third sample quantile -- which is also used in matlab's qqplot) and restrict the slope. Then, matlabs predict() provides a simple way to obtain a confidence interval. How is this done?
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!