alpha.compare: Compare multiple alpha diversity indexes between groups

Description Usage Arguments Value Examples

View source: R/alpha.compare.R

Description

This function calculates average of alpha diversity indexes for a specific rarefaction depth, standardize diversity indexes and compare between groups using linear/linear mixed effect model and adjust for covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
alpha.compare(
  datlist,
  depth,
  mapfile,
  mapsampleid,
  comvar,
  adjustvar,
  personid = "personid",
  longitudinal = "yes",
  age.limit = 1e+06,
  standardize = FALSE
)

Arguments

datlist

the list of your dataframe.

depth

the rarefaction depth of choice. Depth can be "max" (highest depth) or an order (number) of the depth in the list generated by alpha_rarefaction.py

mapfile

mapping file

mapsampleid

sample id in the mapping file

comvar

variable for comparison

adjustvar

variables that need to be adjusted in the model

personid

name of variable for person id. Default is "personid" (applicable when longitudinal="yes").

longitudinal

longitudinal data or one time data. Options are c("yes","no"). Default is "yes".

age.limit

age upper limit for included samples. Default is 1000000 months (~no upper limit).

standardize

standardization of diversity indexes before comparison or not. Default is FALSE.

Value

list of comparison result matrices and mean diversity of all indexes for each samples (with or without standardization)

Examples

1
2
3
4
5
6
7
8
9
data(alphadat)
data(covar.rm)
covar.rm$sampleid<-tolower(covar.rm$sampleid)
#comparison of standardized alpha diversity indexes between genders adjusting for
#breastfeeding and infant age at sample collection in infants <=6 months of age
alphacom<-alpha.compare(datlist=alphadat,depth=3,mapfile=covar.rm,
mapsampleid="sampleid", comvar="gender",adjustvar=c("age.sample","bf"),
longitudinal="yes", age.limit=6,standardize=TRUE)
alphacom$alphasum[,1:5]

Example output

Loading required package: gamlss
Loading required package: splines
Loading required package: gamlss.data

Attaching package:gamlss.dataThe following object is masked frompackage:datasets:

    sleep

Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.2-0  ********** 
For more on GAMLSS look at https://www.gamlss.com/
Type gamlssNews() to see new features/changes/bug fixes.

There were 50 or more warnings (use warnings() to see the first 50)
                id Estimate.genderMale Std. Error.genderMale t value.genderMale
1            chao1         -0.06535198             0.1502276         -0.4350197
2 observed_species         -0.14283545             0.1363228         -1.0477741
3    pd_whole_tree         -0.13246866             0.1452980         -0.9117031
4          shannon         -0.44008064             0.1993104         -2.2080165
  Pr(>|t|).genderMale
1          0.66354814
2          0.29474270
3          0.36192504
4          0.02724312

metamicrobiomeR documentation built on Nov. 9, 2020, 5:06 p.m.