欢迎大家来到IT世界,在知识的湖畔探索吧!
分享兴趣,传播快乐,增长见闻,留下美好!
亲爱的您,这里是LearningYard新学苑。
今天小编给您带来
【周周记:数学建模学习(30)】
欢迎您的访问!
Share interest, spread happiness, increase knowledge, leave a beautiful!
Dear, this is LearningYard New Academy.
Today, the editor brings you
“Weekly Diary: Learning Mathematical Modeling (30)”
Welcome to your visit!
变量类型及相关分析理论介绍
Introduction to the types of variables and related analysis theories
一.变量类型
One. Variable type
1.连续变量(Continuous Variables):
定义:可以取无限多个值的变量,通常是通过测量得到的。
Definition: A variable that can take an infinite number of values, usually by measurement.
例子:身高、体重、温度、时间等。
Examples: height, weight, temperature, time, etc.
2.离散变量(Discrete Variables):
定义:只能取有限个或可数个值的变量,通常是通过计数得到的。
Definition: A variable that can only take a finite number of or several values, usually by counting.
例子:孩子的数量、班级中学生的数量、车辆的数量等。
Examples: the number of children, the number of students in the class, the number of vehicles, etc.
3.分类变量(Categorical Variables):
定义:表示类别或分组的变量,不涉及数值大小。
Definition: A variable that represents a category or grouping, regardless of numeric size.
例子:性别、种族、国籍等。
Examples: gender, race, nationality, etc.
4.有序分类变量(Ordinal Categorical Variables):
定义:分类变量的一种,其中的类别有自然的、有意义的顺序。
Definition: A type of categorical variable in which categories have a natural, meaningful order.
例子:教育水平(小学、中学、大学)、满意度等级(不满意、一般、满意)。
Examples: education level (primary, secondary, university), satisfaction level (unsatisfactory, fair, satisfactory).
5.二元变量(Binary Variables):
定义:只有两个可能值的变量,通常用来表示是/否,有/无等。
Definition: A variable with only two possible values, usually used to represent yes/no, yes/no, etc.
例子:性别(男/女)、是否吸烟(是/否)。
Examples: gender (male/female), smoking (yes/no).
二.相关分析
Two. correlation analysis
1. 皮尔逊相关系数(Pearson Correlation Coefficient)
定义: 皮尔逊相关系数是衡量两个连续变量之间线性关系强度和方向的统计量。它的值介于-1到1之间,其中1表示完全正相关,-1表示完全负相关,0表示没有线性相关。
Definition: The Pearson correlation coefficient is a statistic that measures the strength and direction of a linear relationship between two continuous variables. It has a value between -1 and 1, where 1 means a perfect positive correlation, -1 a complete negative correlation, and 0 a no linear correlation.
计算公式:
Calculation formula:
其中:
There into:
xi和 yi是两个变量的观测值。
xi and yi are observations for two variables.
xˉ和 yˉ 是它们的样本均值。
xˉ and yˉ are their sample means.
n是样本大小。
n is the sample size.
假设条件:
Assumptions:
两个变量之间存在线性关系。
There is a linear relationship between the two variables.
数据是连续的,并且近似正态分布。
The data is continuous and approximately normally distributed.
两个变量的方差都不为零。
Neither variable has zero variance.
应用场景: 适用于测量两个连续变量之间的线性关系,如身高与体重之间的关系。
Application scenario: It is suitable for measuring the linear relationship between two continuous variables, such as the relationship between height and weight.
2.斯皮尔曼等级相关系数(Spearman’s Rank Correlation Coefficient)
定义: 斯皮尔曼等级相关系数是一种非参数的统计度量,用于评估两个变量之间的单调关系。它不要求数据服从特定的分布,也不要求变量是连续的。
Definition: Spearman’s rank correlation coefficient is a nonparametric statistical measure used to evaluate the monotonic relationship between two variables. It doesn’t require the data to obey a specific distribution, nor does it require the variables to be continuous.
计算公式:
Calculation formula:
其中,di是每对观测值的秩次差,n是观测值的数量。
where di is the rank difference of each pair of observations, and n is the number of observations.
计算步骤:
Calculation steps:
a.将每个变量的每个值转换为等级(如果两个值相同,则分配平均等级)。
a.Convert each value of each variable to a grade (if the two values are the same, an average grade is assigned).
b.使用皮尔逊相关系数的公式计算这些等级之间的相关性。
b.Calculate the correlation between these grades using the formula of the Pearson correlation coefficient.
解释:
Interpretation:
ρ=1表示完全正单调相关。
ρ=1 indicates a completely positive monotonic correlation.
ρ=−1 表示完全负单调相关。
ρ=−1 indicates a completely negative monotonic correlation.
ρ=0表示没有单调相关。
ρ=0 indicates that there is no monotonic correlation.
假设条件:
Assumptions:
变量之间存在单调关系(不一定是线性的)。
There is a monotonic relationship between variables (not necessarily linear).
不要求数据服从正态分布。
Data is not required to be normally distributed.
适用于有序分类变量和连续变量。
Suitable for ordinal categorical and continuous variables.
应用场景: 适用于测量两个变量之间的单调关系,即使它们不是线性的。例如,它可以用于评估教育水平(分类变量)与收入之间的关系。
Application scenario: Suitable for measuring monotonic relationships between two variables, even if they are not linear. For example, it can be used to assess the relationship between education level (categorical variable) and income.
假设检验
Hypothesis testing
在实际应用中,我们通常需要对相关系数进行假设检验,以确定观察到的相关性是否具有统计学意义。
In practice, we often need to perform hypothesis testing on correlation coefficients to determine whether the observed correlation is statistically significant.
皮尔逊相关系数的假设检验通常涉及计算t统计量,然后使用t分布来确定p值。
Hypothesis testing of Pearson’s correlation coefficients typically involves calculating the t-statistic and then using the t-distribution to determine the p-value.
斯皮尔曼等级相关系数的假设检验通常涉及使用非参数方法,如Mann-Whitney U检验。
Hypothesis testing of Spearman’s rank correlation coefficients typically involves the use of nonparametric methods such as the Mann-Whitney U test.
如果p值小于显著性水平(例如0.05),则我们拒绝零假设(即两个变量之间没有相关性),认为相关性是显著的。
If the p-value is less than the significance level (e.g., 0.05), we reject the null hypothesis (i.e., there is no correlation between the two variables) and consider the correlation to be significant.
综合分析
Comprehensive analysis
适用性:皮尔逊相关系数适用于连续变量且数据近似正态分布的情况,而斯皮尔曼等级相关系数适用于非正态分布的数据或有序分类变量。
Applicability: Pearson correlation coefficients are suitable for continuous variables with approximately normal data distribution, while Spearman’s rank correlation coefficients are suitable for non-normally distributed data or ordinal categorical variables.
稳健性:斯皮尔曼等级相关系数对异常值和非线性关系更为稳健。
Robustness: Spearman’s rank correlation coefficient is more robust to outliers and nonlinear relationships.
解释性:两者都能提供关于变量之间关系方向和强度的信息,但解释时需要注意它们的计算基础和假设条件。
Explanatory: Both provide information about the direction and strength of the relationships between variables, but they need to be interpreted with attention to their computational basis and assumptions.
如果您对今天的文章有独特的看法,
欢迎给我们留言,
让我们相约明天,
祝您今天过得开心!
That’s all for today’s share.
If you have a unique view of today’s article,
Please leave us a message,
Let’s meet tomorrow,
Have a nice day!
本文由LearningYard新学苑原创,如有侵权,请联系删除。
参考资料:哔哩哔哩
翻译:Kimi
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://itzsg.com/85225.html