Cannot find the plot options for LinearModels.fit using a constant

1 view (last 30 days)
I have some x,y data that may or may not show a plateau depending on experimental conditions. Where the plateau shows up on the x-axis will depend on the sample. Fitting to these plateaus will therefore be relevant for me.
I can fit to the plateaus using just a constant. My code is shown below
DataFileNumber = 11;
xdata = DataFiles{1,DataFileNumber}.data(:,1);
ydata = DataFiles {1,DataFileNumber}.data(:,2);
% Fit model to data.
FitRange = (xdata >= 0.04) & (xdata <= 0.05); % region with plateau
MyFit = LinearModel.fit(xdata(FitRange),ydata(FitRange), 'constant');
% Plot and display the results
disp(MyFit);
plotResiduals(MyFit,'caseorder')
The constant I get out of it and the MyFit.Fitted values corresponds well to the different plateaus when I inspect them in the variable editor. But I cannot produce a plot with the fitted constant shown together with my data. “plot(MyFit)” gives me a histogram.
I saw Richard’s video about some of the features in (Non)LinearModel.fit ( http://blogs.mathworks.com/videos/2012/03/16/regression-in-matlab/ ) and 0:48 in the video he shows a really nice plot where you can see the fitted model + std error shown together the data. Unfortunatly, you cannot see what command he uses. Does anyone know?
Generally, I cannot find the plot options for (Non) LinearModels.fit. The doc called LinearModel.plot ( http://www.mathworks.se/help/stats/linearmodel.plot.html ) list one option, plot(fitname), but Richard generates several plots. I know many of them are not relevant when I just fit a constant. But for future reference, it would be nice have a list of the commands you can use to produce plots from your fit :)

Answers (0)

Categories

Find more on Sparse Matrices 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!