包含 R 中给定点百分比的椭圆
我正在绘制 F1/F2 元音图(一个例子是在这里)。每个元音都有几个点/值,我想在这些点周围画一个椭圆,这样:
- 椭圆覆盖至少 80% 的点(即上图中“i”有几个值,但它们包含在椭圆内)。
- 位于最小/最大值方向。
我可能把事情复杂化了,但三角学和数学对我来说是希腊语。以下是我尝试过的。
Ellipsoidhull()
Ellipsoidhull () 位于包“cluster”中。如果我将具有 F1 和 F2 的矩阵传递给函数,它似乎计算了椭圆的中心,但方向值很大。例如:
> olm
ol.f1 ol.f2 # f1/f2 data
[1,] 501.3 850.5
[2,] 488.5 906.5
[3,] 456.3 857.0
[4,] 505.8 895.3
[5,] 499.5 898.0
[6,] 431.8 891.5
[7,] 416.3 870.5
[8,] 506.0 887.8
[9,] 500.3 985.8
[10,] 513.5 955.3
[11,] 531.5 958.0
[12,] 483.0 847.3
[13,] 533.3 982.8
[14,] 480.8 881.8
[15,] 484.3 884.5
如果传递给 ellipsoidhull :
> ellipsoidhull(olm)
'ellipsoid' in 2 dimensions:
center = ( 480.69 904.33 ); squared ave.radius d^2 = 2
and shape matrix =
ol.f1 ol.f2
ol.f1 2115.5 1449.5
ol.f2 1449.5 3558.2
hence, area = 14636
我想弄清楚如何绘制椭圆并不难,但是“形状矩阵”(最大/最小半径值?)太高了。顺便说一句,感谢 Freednode 上的 #R 提供的提示。
来自 EMU-R 的源代码
然后,我研究了 EMU-R 的代码,它是与 EMU,除其他外,可以用椭球体绘制 F1/F2。似乎可以做到这一点的代码是 这里 但我不明白椭圆是如何绘制的。
任何帮助表示赞赏。
I'm drawing F1/F2 vowel graph (an example is here). Each vowel has several points/values, and I'd like to draw an ellipse around the points, so that:
- ellipse covers at least 80% of points (ie. in the picture above "i" has several values, but they are contained within the ellipse).
- is positioned in the direction on min/max values.
I may be complicating the stuff, but trigonometry and maths are Greek to me. Below is what I've tried.
Ellipsoidhull()
Ellipsoidhull() is in the package package "cluster". If I pass to a function a matrix with F1 and F2, it seems to calculate the center of the ellipse, but the directional values are huge. For example:
> olm
ol.f1 ol.f2 # f1/f2 data
[1,] 501.3 850.5
[2,] 488.5 906.5
[3,] 456.3 857.0
[4,] 505.8 895.3
[5,] 499.5 898.0
[6,] 431.8 891.5
[7,] 416.3 870.5
[8,] 506.0 887.8
[9,] 500.3 985.8
[10,] 513.5 955.3
[11,] 531.5 958.0
[12,] 483.0 847.3
[13,] 533.3 982.8
[14,] 480.8 881.8
[15,] 484.3 884.5
If passed to ellipsoidhull
:
> ellipsoidhull(olm)
'ellipsoid' in 2 dimensions:
center = ( 480.69 904.33 ); squared ave.radius d^2 = 2
and shape matrix =
ol.f1 ol.f2
ol.f1 2115.5 1449.5
ol.f2 1449.5 3558.2
hence, area = 14636
I guess it wouldn't be hard to figure out how to draw an ellipse, but the "shape matrix" (max/min radius values?) is too high. Btw, thanks to #R on Freednode for the tips.
Source code from EMU-R
Then, I've taken a look into the code of EMU-R, R package that works with EMU that can, amongst other things, draw F1/F2 with ellipsoids. The code that seems to do that is here but I don't understand how the ellipse is drawn.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,对于您的数据:
另一个包 mixtools 具有类似的功能,但使用 alpha 级别而不是 1-alpha:
这将用新的估计覆盖早期的图(在本例中稍微窄一些。
So with your data:
Another package, mixtools, has similar capabilities but uses the alpha level rather than the 1-alpha:
Which would overlay the earlier plot with the new estimate (which is slightly narrower in this case.