Correlation analysis
1 min readMay 18, 2023
*creating a dataframe*;
data correlation
input tree dbh heigh production;
label /*assigning labels to the data headers*/
tree = "Tree"
dbh = "DBH (m)"
height = "Height (m)"
production = "Production(kg)";
datalines;
1 0.20 5.06 2.32
2 0.21 6.24 2.23
3 0.40 7.16 4.61
4 0.24 5.47 3.16
5 0.19 5.50 2.13
6 0.10 5.39 2.00
7 0.15 5.84 2.46
8 0.25 5.40 2.86
9 0.20 5.43 2.49
10 0.13 7.25 1.58
11 0.16 6.69 1.78
12 0.14 5.41 1.74
13 0.13 5.69 1.60
14 0.24 22.45 2.43
15 0.07 6.33 1.62
16 0.43 7.25 4.96
17 0.19 5.38 2.18
18 0.25 5.59 2.62
19 0.17 5.38 2.63
20 0.33 6.99 3.33
21 0.15 6.05 1.76
22 0.22 6.85 3.22
23 0.32 6.41 3.47
24 0.27 5.39 2.95
25 0.30 8.99 2.99
26 0.26 6.40 2.84
27 0.35 10.54 4.15
28 0.24 5.58 3.23
29 0.20 5.30 2.63
30 0.50 8.55 5.04
;
*running the dataframe*;
proc print data = correlation label noobs;
/*noobs: remove the observations column from the dataframe*/
title: "..:: Production of essential oils (kg) ::..";
run;
*person x spearman correlation*;
proc corr data = correlation pearson spearman nosimple;
/* pearson: brings the Pearson statistics;
spearman: the Spearman statistic;
nosimples: removes the basic statistics of mean and standard deviation*/
var production;
with dbh height;
run;
*pearson x spearman correlation with histomgram*;
proc corr data = correlation plots=matrix(histogram) spearman nosimple;
var production;
with dbh height;
run;




