Skip to main content
U.S. flag

An official website of the United States government

Here’s how you know

Dot gov

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

HTTPS

Secure .gov websites use HTTPS
A lock (LockA locked padlock) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

    • Environmental Topics
    • Air
    • Bed Bugs
    • Cancer
    • Chemicals, Toxics, and Pesticide
    • Emergency Response
    • Environmental Information by Location
    • Health
    • Land, Waste, and Cleanup
    • Lead
    • Mold
    • Radon
    • Research
    • Science Topics
    • Water Topics
    • A-Z Topic Index
    • Laws & Regulations
    • By Business Sector
    • By Topic
    • Compliance
    • Enforcement
    • Laws and Executive Orders
    • Regulations
    • Report a Violation
    • Environmental Violations
    • Fraud, Waste or Abuse
    • About EPA
    • Our Mission and What We Do
    • Headquarters Offices
    • Regional Offices
    • Labs and Research Centers
    • Planning, Budget, and Results
    • Organization Chart
    • EPA History

Breadcrumb

  1. Home
  2. Causal Analysis/Diagnosis Decision Information System (CADDIS)

Using R to Estimate Taxon-Environment Relationships

  • Introduction
  • Using Taxon-Environment Relationships
  • Estimating Taxon-Environment Relationships
  • Computing Inferences
  • R Scripts

How to Estimate Taxon-Environment Relationships Using taxon.env()

Helpful Links
Topics In R Scripts
  • Overview
  • Download Scripts and Sample Data
  • Loading Data
  • Central Tendencies
  • Environmental Limits
  • Parametric Regressions
  • Non-Parametric Regressions
  • Significance Tests
  • Area Under the ROC Curve
  • Curve Shape
  • Weighted Average Inference
  • Estimate Taxon-Environment Relationships Using taxon.env()
Other Pages And Websites
  • Compute Biological Inferences
  • Download Files and Set Up R
  • Standardize Taxonomy
  • Using Existing Taxon-Environment Relationships

PECBO Appendix Site Map

The simple script provided on the R Scripts for Parametric Regressions page estimates relationships between taxon occurrences and a single environmental variable. This script can be modified to model multiple variables, but an easier approach is to use the script taxon.env included in the the library bio.infer. An added advantage of using taxon.env is that model results are automatically formatted for using maximum likelihood inferences (mlsolve) to compute biological inferences (see more description on the Compute Biological Inferences page in the Helpful Links box).

If you have not yet tried Using Existing Taxon-Environment Relationships (see the Helpful Links box) to compute inferences at your sites, please do so. The reasons for working through methods for Using Existing Taxon-Environment Relationships are twofold. First, many of the scripts introduced in this process are also used to estimate taxon-environment relationships from your local data. Second, inferences computed from existing taxon-environment relationships can often provide a useful point of comparison when developing your own models.

This remainder of this page provides a step-by-step guide for estimating taxon-environment relationships using Oregon data as an example.

The results from this process (coef.local) can now be used to compute inferences, using the same procedure as with existing taxon-environment relationships.

  1. Load inference library.
    Set up a workspace and install the R library bio.infer (see Download Files and Set Up R in the Helpful Links box).

    Load the biological inference library by typing at the R prompt:

    library(bio.infer) 
     
  2. Load local benthic macroinvertebrate count and environmental data.

    Load sample data into R with the following commands.

    data(bcnt.OR)
    data(envdata.OR) 
     
  3. Standardize taxonomy of benthic count data (for more information, see Standardize Taxonomy in the Helpful Links box).

    Type at the R prompt:

    data(itis.ttable) # Load ITIS taxonomic information 
    bcnt.tax <- get.taxonomic(bcnt.OR, itis.ttable) 
     
  4. Estimate taxon-environment relationships.

    Type at the R prompt:

    coef.local <- taxon.env(~sed + sed^2,
    bcnt.tax, envdata.OR, 
    bcnt.siteid = "SVN", bcnt.abndid ="CountValue", env.siteid = "STRM.ID")

    The calling statement above specifies that we wish to model the occurrence of different taxa as a function of the variable sed (the percent sand and fines in the substrate) and the square of sed. Then, the names of the benthic count data (bcnt.tax) and the environmental data (envdata.or) are provided. Finally, the names of different fields that contain sample identifiers and the abundance data in the benthic count file are supplied.

  5. The results from this process (coef.local) can now be used to compute inferences, using the same procedure as described on the page Using Existing Taxon-Environment Relationships (see the Helpful Links box).

Causal Analysis/Diagnosis Decision Information System (CADDIS)

  • CADDIS Home
    • About CADDIS
    • Frequent Questions
    • Publications
    • Recent Additions
    • Related Links
    • CADDIS Glossary
  • Volume 1: Stressor Identification
    • About Causal Assessment
    • Getting Started
    • Step 1. Define the Case
    • Step 2. List Candidate Causes
    • Step 3. Evaluate Data from the Case
    • Step 4. Evaluate Data from Elsewhere
    • Step 5. Identify Probable Causes
  • Volume 2: Sources, Stressors and Responses
    • About Sources
      • Urbanization
    • About Stressors
  • Volume 3: Examples and Applications
    • Analytical Examples
    • Worksheet Examples
    • State Examples
    • Case Studies
    • Galleries
  • Volume 4: Data Analysis
    • Selecting an Analysis Approach
    • Getting Started
    • Basic Principles & Issues
    • Exploratory Data Analysis
    • Basic Analyses
    • Advanced Analyses
    • PECBO Appendix
    • Download Software
    • Data Analysis Topics (A -Z)
  • Volume 5: Causal Databases
    • Learn about CADLink
Contact Us about CADDIS
Contact Us to ask a question, provide feedback, or report a problem.
Last updated on February 7, 2025
  • Assistance
  • Spanish
  • Arabic
  • Chinese (simplified)
  • Chinese (traditional)
  • French
  • Haitian Creole
  • Korean
  • Portuguese
  • Russian
  • Tagalog
  • Vietnamese
United States Environmental Protection Agency

Discover.

  • Accessibility Statement
  • Budget & Performance
  • Contracting
  • EPA www Web Snapshot
  • Grants
  • No FEAR Act Data
  • Plain Writing
  • Privacy
  • Privacy and Security Notice

Connect.

  • Data
  • Inspector General
  • Jobs
  • Newsroom
  • Regulations.gov
  • Subscribe
  • USA.gov
  • White House

Ask.

  • Contact EPA
  • EPA Disclaimers
  • Hotlines
  • FOIA Requests
  • Frequent Questions
  • Site Feedback

Follow.