CDPD: Generating conditional density probability distributions...

Description Usage Arguments Value Author(s) Examples

View source: R/iSWIFT.R

Description

This function is used to feed the required data to the 'SWIFT model' in order to generate synthetic field data (number of requested synthetic field data is specified by the user) to which random extraction errors are add. From the resulting set of synthetic field data, the respective conditional density probability distribution can be derived in the 'LogLikOptim' Function.

IMPORTANT: Note that for this function to properly work, all variables of the SWIFT model should be declared locally or globally.

Usage

1
 CDPD(beta.i=NULL)

Arguments

beta.i

Description: Allocation parameter that describes the exponential decay of the distribution of absorbing root surfaces for the focal plant; Functionality: used in the iSWIFT loglikelihood optimization Structure: Randomly assigned numeric value within defined ranges as provided in the 'optim' function.

Value

This function will create a matrix of synthetic field data of xylem water isotope compositions (D2H and/or D18O)(number of synthetic field data points are user defined = 'q') with account for extraction error, and by considering variable restrictions of both soil heterogeneity and plant traits which are input values of the 'SWIFT' model. Hence, a matrix of two colums (D2H and D18O) and 'q' rows

Author(s)

Hannes De Deurwaerder, Marco D. Visser, Matteo Detto, Pascal Boeckx, Felicien Meunier, Pedro Herve Fernandez and Hans Verbeeck

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
CDPD <- function(beta.i=NULL){
    #--------------------------------------------------------------------#
    # NOTE that for this function to properly work, all variables of the #
    # SWIFT model should be declared locally or globally.                #
    #--------------------------------------------------------------------#
    
  # create empty matrix
  PS <- matrix(NA, SWIFTitterations, 2)
  colnames(PS) <- c('D2H', 'D18O')
  
  # Create matrix of biophysical variables needed for the SWIFT model for which
  # values are random extracted from user defined variable ranges
  BiophysVariables <- VarMatrix(beta.i)
  
  # generate soil water potential heterogeneity
  PSIprofiles <- SoilHeterogeneity(DataType="PSI")
  
  # generate soil water isotope composition heterogeneity
        if(ConsideredIsotopes=='D2H'){
          soilDeuterium <- SoilHeterogeneity(DataType="D2H")
          PS[,'D2H'] <- ProbabilitySpace(beta.i, BiophysVariables, PSIprofiles, 
                                         soilDeuterium, soilOxygen=NULL)
        }else{
          soilOxygen <- SoilHeterogeneity(DataType="D18O")
          PS[,'D18O'] <- ProbabilitySpace(beta.i, BiophysVariables, PSIprofiles, 
                                         soilDeuterium=NULL, soilOxygen)}
        # If dual, deuterium can be obtained from oxygen via LMWL 
        # (as is considered in this example)
        if(ConsideredIsotopes == 'Dual'){
          PS[,'D2H'] <- LMWLslope*PS[,'D18O'] + LMWLintercept 
        }

  # Addition of extraction error to the produced isotope values of SWIFT
  if ( ConsideredIsotopes != 'D18O' ){
    PS[,'D2H']<- PS[,'D2H']+rsn(SWIFTitterations, xi=0, omega=1, alpha=-10^9)}
  if ( ConsideredIsotopes != 'D2H' ){
    PS[,'D18O']<-PS[,'D18O']+rsn(SWIFTitterations, xi=0, omega=.1, alpha=-10^9)}
  
  return(PS)  # Return as matrix
}

HannesDeDeurwaerder/iSWIFT documentation built on Dec. 17, 2021, 10:29 p.m.