Help CenterHelp Center
将数据排除在fit中
tf =排除edata(x,y,'box',box)
tf =排除edata(x,y,'域',域)
tf = excludedata (x, y,范围,范围)
tf =排除edata(x,y,'indices',索引)
例子
TF= excrudedata(X,,,,y,'盒子',box)returns a logical array that indicates which elements are outside the box in the xy-plane specified bybox。元素TF框外的数据点等于1,框内的数据点为0。在使用曲线拟合曲线时排除数据合身,,,,specifyTF作为'Exclude'价值。
TF= excrudedata(X,,,,y,'盒子',box)
TF
X
y
box
合身
'Exclude'
TF= excrudedata(X,,,,y,,,,'领域',,,,领域)标识具有X- 间隔之外的价值领域。
TF= excrudedata(X,,,,y,,,,'领域',,,,领域)
领域
TF= excrudedata(X,,,,y,'范围',范围)标识数据点y- 间隔之外的价值范围。
TF= excrudedata(X,,,,y,'范围',范围)
范围
TF= excrudedata(X,,,,y,,,,'indices',指数)用等于索引标识数据点指数。
TF= excrudedata(X,,,,y,,,,'indices',指数)
指数
全部收缩
Visualize exclusion rules using random data.
生成随机Xandy数据。
Xdata = -3 + 6*rand(1,1e4); ydata = -3 + 6*rand(1,1e4);
例如,排除框内的数据[-1 1 -1 1]or outside the domain[-2 2]。
[-1 1 -1 1]
[-2 2]
outliers1 = ~excludedata(xdata,ydata,'盒子',[-1 1 -1 1]);outliers2 = dubludedata(xdata,ydata,'领域',,,,[-2 2]);outliers = outliers1|outliers2;
绘制未排除的数据。白色区域对应于排除的区域。
plot(xdata(~outliers),ydata(~outliers),'。')axis([-3 3 -3 3]) axissquare
从2000年美国总统大选中加载佛罗里达州的投票和县名。
加载flvote2k
使用投票计数的两名主要党派候选人布什和戈尔作为对第三方候选人布坎南的投票的预测,并策划了分散:
情节(布什,布坎南,'rs')holdon情节(戈尔,布坎南,'bo') 传奇(“灌木数据”,,,,'Gore data')
Assume a model where a fixed proportion of Bush or Gore voters choose to vote for Buchanan.
f = fittype({'X'})
f =线性模型:f(a,x)= a*x
排除缺席选民的数据,他们没有使用有争议的“蝴蝶”投票。
nobutterfly = strcmp(counties,“缺席选票”);
对两个数据集进行模型的强大拟合度,不包括缺席选民。
bushfit = fit(bush,buchanan,f,'Exclude',Nobutterfly,'强大的',,,,'在');gorefit = fit(Gore,Buchanan,F,'Exclude',Nobutterfly,'强大的',,,,'在');
强大的拟合使离群值低,因此可以使用稳健拟合的大残留物来识别异常值。
人物图(布什菲特,布什,布坎南,'rs',,,,“残差”)holdon情节(GoreFit,Gore,Buchanan,'bo',,,,“残差”)
计算残差。
灌木丛=布坎南-Feval(灌木丛,灌木丛);Goreres = Buchanan -Feval(Gorefit,Gore);
Identify large residuals as those outside the range [-500 500].
Bushoutliers = Defordedata(Bush,Bushres,'范围',[-500 500]);goreoutliers = excludedata(gore,goreres,'范围',[-500 500]);
显示与异常值相对应的县。迈阿密戴德和布劳沃德县对应于最大的预测指标值。棕榈滩县(Palm Beach County)是该州唯一使用“蝴蝶”投票的县,对应于最大的剩余价值。
counties(bushoutliers)
ans =2x1单元{'Miami-Dade'} {'Palm Beach'}
县(goreoutliers)
ans =3x1 cell{'Broward'} {'Miami-Dade'} {'Palm Beach'}
数据值的数据位点,指定为数字向量。
数据值,指定为数字向量。
在外部找到数据的框,指定为数字向量[xmin xmax ymin ymax]有四个元素。
[xmin xmax ymin ymax]
Example:[-1 1 0 2]
域在外部找到数据,指定为数字向量[Xmin Xmax]有两个元素。
[Xmin Xmax]
Example:[-1 1]
Range to find data outside of, specified as a numeric vector[Ymin Ymax]有两个元素。
[Ymin Ymax]
Example:[3 4]
要找到的数据点的索引,指定为数字向量。
Example:[3 7 9]
合身|合身options
合身options
您有此示例的修改版本。您想用您的编辑打开这个示例吗?
您单击了与此MATLAB命令相对应的链接:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
联系您当地的办公室