尺度变换和坐标系变换有什么区别 [英] what is the difference between scale transformation and coordinate system transformation

查看:33
本文介绍了尺度变换和坐标系变换有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用于坐标变换的coord_trans函数的文档中,它说这个函数和scale_x_log10之间的区别是变换发生在统计之后,而尺度变换发生在之前,我没有明白这一点在这里查看文档.以及如何使用这两种方法绘制数据

in the documentation for coord_trans function that is used for coordinates transformation it says that the difference between this function and scale_x_log10 is transformation occurs after statistics, and scale transformation occurs before , I didn't get the point check documentation here . and how the data is plotted using both methods

推荐答案

您提供的文档中的引述告诉我们,比例变换发生在之前与图有关的任何统计分析.

The quote from the documentation you supplied tells us that scale transformation occurs before any statistical analysis pertaining to the plot.

文档中提供的示例特别有用,因为它涉及回归分析.在尺度变换的情况下,即使用

The example provided in the documentation is especially informative, since it involves regression analysis. In the case of scale transformation, i.e. using

d <- subset(diamonds, carat > 0.5)
qplot(carat, price, data = d, log="xy") + geom_smooth(method="lm"),

首先转换尺度,然后然后进行回归分析.最小化误差的 SS 是在转换轴(或转换数据)上完成的,只有当您认为变量对数之间存在线性关系时才需要这样做.结果是对数图上的一条直线,即使轴没有按 1:1 缩放(在本例中很难看到).

the scales are first transformed and then the regression analysis is performed. Minimizing the SS of the errors is done on transformed axes (or transformed data), which you would only want if you thought that there is a linear relationship between the logs of variables. The result is a straight line on a log-log plot, even though the axes are not scaled 1:1 (hard to see in this example).

同时,当使用

qplot(carat, price, data = d) +
geom_smooth(method="lm") +
coord_trans(x = "log10", y = "log10")

首先对未变换的数据(和轴,即独立于绘图)执行回归分析,然后用变换的坐标绘制所有内容.这导致回归线根本不是直线,因为它的方程(或者说它的点的坐标)在坐标变换过程中发生了变化.

the regression analysis is performed first on untransformed data (and axes, that is, independently of the plot) and then everything is plotted with transformed coordinates. This results in the regression line not being straight at all, because its equation (or rather the coordinates of its points) is transformed in the process of coordinate transformation.

在文档中使用

library(scales)
qplot(carat, price, data=diamonds, log="xy") +
  geom_smooth(method="lm") +
  coord_trans(x = exp_trans(10), y = exp_trans(10))

在这里您可以看到 1. 使用比例变换,2. 拟合一条线,以及 3. 将坐标变换回原始(线性)系统,这不会产生应有的直线.在第一个场景中,您实际上拟合了一条指数曲线,该曲线在对数对数图上看起来是直的.

Where you can see that 1. using a scale transformation, 2. fitting a line and 3. transforming coordinates back to the original (linear) system, this doesn't produce a straight line as it should. In the first scenario, you actually fitted an exponential curve which looked straight on a log-log plot.

这篇关于尺度变换和坐标系变换有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆