cor.par: Partial correlation

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function calculates the partial correlation matrix between a set of traits and a third control variable.

Usage

1
cor.par(traits, c.trait, trait.names = FALSE, silent=FALSE)

Arguments

traits

a dataframe or a matrix object containing traits as columns and individuals as rows

c.trait

a vector containing the third control variable to estimate partial correlations, for instance: organ size or individual size

trait.names

a logical. If 'FALSE' (default), trait names in the output are defined as "Trait 1", "Trait 2", ..., "Trait n". If 'TRUE', output trait names are the same than those in the input dataframe

silent

a logical. If 'FALSE' (default), return a warning message if any row contains missing data (and is removed from the original dataset before computation).

Details

This function is utilised internally by pintsc and pintsc.boot to estimate the phenotypic integration index from partial correlations. Rows containing missing values are removed.

Value

A matrix with the pairwise partial correlation between traits.

Author(s)

R. Torices, A.J. Muñoz-Pajares

See Also

pcor, pcor.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Dataset from Torices & Méndez (2014)
# This data set represents the dry mass (in grams) of inflorescence components of the sunflower
# species Tussilago farfara. The inflorescences were dissected in 'SCAPE', 'RECEPTACLE', 'MALEFL'
# (male flowers), 'OVAR' (reproductive part of female flowers), and 'RAYS' (the petaloid ray of
# female flower). Furthermore in the last column the total weight of the inflorescence is added
# 'TOTALSIZE'

data(tussilago)
print(tussilago)
cor.par(tussilago[,1:5], tussilago[,6], trait.names=TRUE) # NA automatically removed

traits<-na.exclude(tussilago) # NA manually removed
cor.par(traits[,1:5], traits[,6], trait.names=TRUE)

Example output

    SCAPE RECEPTACLE MALEFL   OVAR   RAYS TOTALSIZE
1  0.1286     0.0271 0.0167     NA     NA    0.1972
2  0.0893     0.0308 0.0062     NA     NA    0.1515
3  0.3346     0.0179 0.0106     NA     NA    0.3888
4  0.1413     0.0211 0.0105     NA     NA    0.1957
5  0.1060     0.0146 0.0117     NA     NA    0.1506
6  0.1919     0.0227 0.0140     NA     NA    0.2493
7  0.2111     0.0211 0.0071     NA     NA    0.2667
8  0.2833     0.0217 0.0136     NA     NA    0.3400
9  0.0649     0.0107 0.0067     NA     NA    0.0903
10 0.0479     0.0112 0.0053 0.0061 0.0035    0.0836
11 0.2154     0.0134 0.0083 0.0055 0.0048    0.2577
12 0.0739     0.0158 0.0081 0.0092 0.0068    0.1298
13 0.1515     0.0160 0.0101     NA     NA    0.1960
14 0.1354     0.0176 0.0086 0.0190 0.0086    0.2168
15 0.0955     0.0160 0.0097 0.0112 0.0057    0.1550
16 0.0341     0.0083 0.0040     NA     NA    0.0567
17 0.0936     0.0153 0.0104 0.0091 0.0064    0.1503
18 0.1063     0.0115 0.0000 0.0041 0.0015    0.1290
19 0.0444     0.0106 0.0058 0.0050 0.0035    0.0778
20 0.0585     0.0109 0.0019 0.0103 0.0065    0.1049
21 0.0697     0.0147 0.0095 0.0101 0.0084    0.1309
22 0.1089     0.0128 0.0079 0.0070 0.0078    0.1592
23 0.0861     0.0173 0.0096 0.0099 0.0078    0.1484
24 0.1648     0.0141 0.0117 0.0096 0.0060    0.2218
25 0.0973     0.0139 0.0053 0.0132 0.0066    0.1561
26 0.0974     0.0147 0.0067 0.0095 0.0057    0.1492
27 0.1149     0.0130 0.0068 0.0102 0.0082    0.1715
28 0.1127     0.0154 0.0119 0.0106 0.0059    0.1730
29 0.2120     0.0182 0.0101 0.0164 0.0098    0.2927
                SCAPE RECEPTACLE     MALEFL       OVAR       RAYS
SCAPE       1.0000000 -0.7976886 -0.5271399 -0.8922119 -0.8520839
RECEPTACLE -0.7976886  1.0000000  0.5681779  0.6219155  0.5436065
MALEFL     -0.5271399  0.5681779  1.0000000  0.1615794  0.3835909
OVAR       -0.8922119  0.6219155  0.1615794  1.0000000  0.6733311
RAYS       -0.8520839  0.5436065  0.3835909  0.6733311  1.0000000
Warning message:
In cor.par(tussilago[, 1:5], tussilago[, 6], trait.names = TRUE) :
  Rows containing missing data (11 rows) has been removed to perform the analysis
                SCAPE RECEPTACLE     MALEFL       OVAR       RAYS
SCAPE       1.0000000 -0.7976886 -0.5271399 -0.8922119 -0.8520839
RECEPTACLE -0.7976886  1.0000000  0.5681779  0.6219155  0.5436065
MALEFL     -0.5271399  0.5681779  1.0000000  0.1615794  0.3835909
OVAR       -0.8922119  0.6219155  0.1615794  1.0000000  0.6733311
RAYS       -0.8520839  0.5436065  0.3835909  0.6733311  1.0000000

PHENIX documentation built on May 2, 2019, 4:04 p.m.