To look at the documentation, you'll simply type in
?cor.test. That will bring up this page. It looks
like cor.test takes two vectors x and y. And
then it will compute the correlation coefficient. It looks like
we have a couple methods for determining that coefficient
and we could either use pearson, kendall or spearman. For
our purposes, we'll be using the pearson method. So
your code might have looked like this. Writing this code,
we get a correlation coefficient of 0.0274. This
indicates that there's no meaningful relationship between the
two variables. A good rule of thumb is
that a correlation greater than 0.3 or less
than minus 0.3, is meaningful, but small. Around
0.5 is moderate and 0.7 or greater is
pretty large. Another way to compute the same
coefficient is to use this code. Here, I'm using
the width function for around the data frame. The width function let's us
evaluate an R expression in an environment
constructed from the data. Now, I know
I haven't shown you this function yet but I wanted to introduce it to
you. Running this bit of code we see that we get the same result.
للنظر إلى الوثائق، ما عليكم سوى أن تكتبوا
cor.test. سيعمل هذا على استدعاء هذه الصفحة. يبدو?
أن cor.test يستخدم المتجهين x وy. ثم
سيحسب معامل الارتباط. يبدو أن
لدينا زوجًا من الأساليب لتحديد هذا المعامل
،ويمكننا استخدام pearson أو kendall أو spearman. لأهدافنا الخاصة
سنستخدم أسلوب pearson. لذا
،قد تبدو التعليمة البرمجية قريبة من هذا الشكل. بتشغيل هذه التعليمة البرمجية
نحصل على معامل الارتباط 0.0274. يدل هذا
على أنه لا توجد علاقة ذات معنى بين
المتغيرين. تتمثل إحدى القواعد المبنية على التجربة في
أن الارتباط الأكبر من 0.3 أو الأقل من
سالب 0.3 له معنى ولكنه صغير. ما يبلغ حوالي
0.5 يكون معتدلاً وما يبلغ 0.7 أو أكبر
يكون كبيرًا إلى حد ما. ثمة طريقة أخرى لحساب المعامل نفسه
وهي استخدام هذه التعليمة البرمجية. أستخدم هنا
دالة with لإطار البيانات هذا. تسمح لنا دالة with
بتقييم تعبير R في بيئة
تم إنشاؤها من البيانات. أعلم أنني
لم أُوضِّح لكم هذه الدالة ولكن أردت أن أُقدّمها
.إليكم. بتشغيل هذه التعليمة البرمجية يمكننا رؤية أننا حصلنا على النتيجة نفسها
資料を検索するには?cor.testと入力します
するとこのページが現れます
cor.testにxとy2つのベクターを入れると
相関係数が算出されます
相関係数の発見方法はいくつかあり
ここではピアソン、ケンダル、
スピアマンなどが使えます
今回はピアソン法を使っていきます
コードはこのようになっているかもしれません
コードを実行すると相関係数0.0274が算出されます
これはこの2つの変数に
特に関連性はないということです
経験則からすると0.3以上もしくはマイナス0.3以下が
意味のある係数です でも小さいですね
0.5辺りが普通で0.7以上はかなり大きい数値です
このコードで同じ係数を算出することができます
with関数をデータフレームの周りに使っています
このwith関数を使いデータの環境状態から作られた
R式を求めることができます
これはずっと紹介したかった関数です
このコードでまったく同じ結果が得られます
Para consultar a documentação, basta digitar
?cor.test. Isso abrirá esta página. Parece
que cor.test aceita dois vetores, x e y. Depois,
calcula o coeficiente de correlação. Parece que
temos alguns métodos para determinar esse coeficiente.
Podemos usar pearson, kendall ou spearman. Para
nosso objetivo, usaremos o método pearson. Seu
código será parecido com isto. Ao escrever este código,
obtemos um coeficiente de correlação de 0,0274. Isso
indica que não há nenhuma relação significativa entre as
duas variáveis. Uma boa regra geral é
que a correlação seja maior que 0,3 ou menor
que menos 0,3, significativa, mas pequena. Cerca de
0,5 é moderada e 0,7 ou mais é
grande. Outra forma de calcular o mesmo
coeficiente é usar este código. Aqui, estou usando
a função width para a estrutura de dado aproximada. A função width permite
avaliar uma expressão R em um ambiente
criado com dados. Sei que ainda
não mostrei esta função para você, mas quero
apresentá-la. Ao executar essa parte de código, obtemos o mesmo resultado.
要查看文档 只需输入 ?cor.test
即调出这个页面
似乎 cor.test 带两个矢量 x 和 y
然后将计算关联系数
似乎有多种方法来确定这个系数
我们可以使用 pearson kendall 或 spearman
出于我们的目的 我们将使用 pearson 方法
所以你的代码可能会像这样 编写这个代码
得到关联系数 0.0274
这表示两个变量之间没有实质性的关系
按照经验法则
关联大于 0.3 或者小于 -0.3
表示有意义但是较小
0.5 附近为中等 0.7 或以上为很大
同一个系数的另一种计算方法是
使用这个代码 我围绕着数据帧
使用宽度函数 宽度函数允许我们
在从数据构造的环境中
对 R 表达式求值
我知道还没有给你介绍这个函数 希望介绍给你
运行这个代码 可以得到相同的结果