MATLAB: How can I generate random data with percent of outliers in matlab
g++
I work in multivariate data and I want to do simulation study and use 2 robust estimators so I want to generate random data with outliers how can I do that
Best Answer
If you want normally-distributed data, use therandn function. To create outliers, create a separate matrix with a larger standard deviation.
You could save your fitting values to workspace, using cftool choose analysis and there select the option evaluate fit at Xi (in your case Xi is your x) . Now if you save those results you 'll have a structure containing xi and yfit. You can calculate percent residuals r(%)=100*(yi-yifit)./yi. Just be careful in case your original data aren't sorted by x value to sort them because the output results of fitting analysis are sorted to xi.
Best Answer