Introduction

The suit function is used for computing the suitability score and class of the land units for a given target crop. The function has the following usage:

suit(
  crop,
  terrain = NULL,
  water = NULL,
  temp = NULL,
  mf = "triangular",
  sow_month = NULL,
  minimum = NULL,
  maximum = "average",
  interval = NULL,
  sigma = NULL
)

Check the documentation for details of the arguments. This article will focus on how to use this function. To evaluate the suitability score of Marinduque land units for terrain, soil, water and temperature characteristics, simply run the suit function for each of these characteristics. That is,

library(ALUES)
banana_suit <- suit("banana", terrain=MarinduqueLT)
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
names(banana_suit)
## [1] "terrain" "soil"

The warning above simply tells the user that one of the factor, CECc, in the target crop requirement, has parameter intervals for all suitability classes equal to 16, and the package used this value as the maximum constant for computing the suitability scores. For more, please refer to the Article 2: Methodology used in ALUES of the documentation.

The suit function returns a list of output of target characteristics, in this case "terrain" and "soil". To access the output, simply run the following:

banana_suit[["terrain"]]
banana_suit[["soil"]]

Each of these are lists, with the following names:

names(banana_suit[["soil"]])
## [1] "Factors Evaluated"       "Suitability Score"      
## [3] "Suitability Class"       "Factors' Minimum Values"
## [5] "Factors' Maximum Values" "Factors' Weights"       
## [7] "Crop Evaluated"          "Warning"

So that, to access the factors evaluated, simply run the following:

banana_suit[["soil"]][["Factors Evaluated"]]
## [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"

Targetting Crop

There are 56 crops available in ALUES, and what we've illustrated above are for banana only. Other crops are listed below:

d <- utils::data(package = "ALUES")
alues_data <- d$results[, "Item"]
crop_data <- regmatches(alues_data, gregexpr(paste0("^[A-Z]{2,}", collapse = "|"), alues_data))
crop_data <- unique(unlist(lapply(crop_data, function(x) substr(x, 1, nchar(x)-1))))
crop_data
##  [1] "ALFALFA"    "AVOCADO"    "BAMBOO"     "BANANA"     "BARLEY"    
##  [6] "BEANCA"     "BEANS"      "CABBAGE"    "CARROTS"    "CASHEW"    
## [11] "CASSAVA"    "CHICKPEA"   "CINNAMON"   "CITRUS"     "COCOA"     
## [16] "COCONUT"    "COFFEEAR"   "COFFEERO"   "COTTON"     "COWPEA"    
## [21] "CUCUMBER"   "GROUNDNUTS" "GUAVA"      "LONGAN"     "MAIZE"     
## [26] "MANGO"      "MILLETS"    "OILPALM"    "OLIVES"     "ONION"     
## [31] "PAPAYA"     "PEACH"      "PEAR"       "PEA"        "PEPPERGR"  
## [36] "PERSIMMON"  "PINEAPPLE"  "PLUM"       "POTATOSW"   "POTATO"    
## [41] "RICEBR"     "RICEIW"     "RICENF"     "RICEUR"     "RUBBER"    
## [46] "SAFFLOWER"  "SESAME"     "SORGHUM"    "SOYA"       "SUGARCANE" 
## [51] "SUNFLOWER"  "TEA"        "TOBACCO"    "TOMATO"     "WATERMELON"
## [56] "WHEAT"

These are the names for the input string for the suit function. For example, to target sweet potato the input string is not "sweet potato" but rather potatosw. That is,

potato_suit1 <- suit("sweet potato", terrain=MarinduqueLT)
## Error in suit("sweet potato", terrain = MarinduqueLT): Input crop='sweet potato' is not available in the database, see docs for list of ALUES data.
potato_suit2 <- suit("potatosw", terrain=MarinduqueLT)
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.

Targetting Crop Factors

The idea of evaluating a land unit is to match quality of the land against the standard value of the target factor. Therefore, if the crop does not include the factor you are targeting, then there won't be any matching to be done. For example, the land units evaluated above are those in Marindque, which has the following soil and terrain characteristics:

head(MarinduqueLT)
##        Lat      Lon CECc pHH2O CFragm SoilTe
## 1 121.8792 13.52084   12    53     11     12
## 2 121.8875 13.52084   12    52      9     12
## 3 121.8958 13.52084   12    53     10     12
## 4 121.9375 13.52084   12    52     10     12
## 5 121.9458 13.52084   12    54     12     12
## 6 121.9542 13.52084   13    54     11     12

The crop that we are trying to target is banana. The suit function simply require the user to input a string name for the target crop, and the function will look for the corresponding crop datasets. For example, for banana these are the crop requirements datasets for the four characteristics:

BANANATerrain
##       code s3_a s2_a s1_a s1_b s2_b s3_b  wts
## 1   Slope1  6.0    4    2 <NA> <NA> <NA> <NA>
## 2   Slope2 16.0    8    4 <NA> <NA> <NA> <NA>
## 3   Slope3 30.0   16    8 <NA> <NA> <NA> <NA>
## 4    Flood  2.5    2    1 <NA> <NA> <NA>    1
## 5 Drainage  4.0    3    2 <NA> <NA> <NA>    2
## 6   SlopeD  3.0    2    1 <NA> <NA> <NA>    1
BANANASoil
##       code s3_a s2_a  s1_a s1_b s2_b s3_b wts
## 1   CFragm 55.0 35.0  15.0 <NA> <NA> <NA>   3
## 2  SoilDpt 50.0 75.0 100.0 <NA> <NA> <NA>   2
## 3    CaCO3 15.0 10.0   0.0 <NA> <NA> <NA>   3
## 4     Gyps 10.0  4.0   0.0 <NA> <NA> <NA>   3
## 5     CECc 16.0 16.0  16.0 <NA> <NA> <NA>   3
## 6       BS 19.9 20.0  35.0 <NA> <NA> <NA>   3
## 7   SumBCs  2.8  2.8   4.0 <NA> <NA> <NA>   3
## 8    pHH2O  4.5  5.2   5.6  7.5    8  8.2   3
## 9       OC  0.7  0.8   1.5 <NA> <NA> <NA>   2
## 10   ECedS  6.0  4.0   2.0 <NA> <NA> <NA>   3
## 11     ESP 12.0  8.0   4.0 <NA> <NA> <NA>   3
## 12  SoilTe  2.0  4.0   9.0 <NA> <NA> <NA>   2
BANANAWater
##       code s3_a s2_a s1_a s1_b s2_b s3_b  wts
## 1     WyAv 1000 1250 1500 <NA> <NA> <NA> <NA>
## 2 WmDryLen    6    4    3 <NA> <NA> <NA> <NA>
BANANATemp
##        code s3_a s2_a s1_a s1_b s2_b s3_b  wts
## 1   TyMaxAv   14   16   18 <NA> <NA> <NA>    2
## 2   TmMinXm    2    8   15 <NA> <NA> <NA>    2
## 3 TmMinXmAb   -2    0    8 <NA> <NA> <NA> <NA>

These datasets are used by the suit function depending on the specified characteristics of the input land units. So for banana_suit object above, the target crop datasets were BANANATerrain and BANANASoil since the input land unit specified is terrain=MarinduqueLT. However, input land unit only targetted the soil factors and not the terrain factors, since none of the factors in MarinduqueLT matched with the factors in BANANATerrain. That is why, accessing the output for the terrain characteristics for the banana_suit object will return the following:

banana_suit[["terrain"]]
## [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."

Targetting Multiple Characteristics

The example above only targetted the terrain and soil characteristics, but the suit function allows user to also target water and temp simultaneously. This is done as follows:

banana_multi <- suit("banana", terrain=MarinduqueLT, water=MarinduqueWater, temp=MarinduqueTemp, sow_month=2)
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
names(banana_multi)
## [1] "terrain" "soil"    "water"   "temp"

It is necessary to specify the sowing month when specifying the water and temperature characteristics of the input land units. In this case, we are saying that the first sowing month for both water and temperature characteristics correspond to February. No factors were targetted by input land unit for banana for terrain, water and temperature characteristics.

banana_suit[["terrain"]]
## [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."
banana_suit[["water"]]
## NULL
banana_suit[["temp"]]
## NULL
lapply(banana_suit[["soil"]], function(x) head(x))
## $`Factors Evaluated`
## [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"
## 
## $`Suitability Score`
##      CFragm   CECc pHH2O SoilTe
## 1 0.8533333 0.7500     0   0.96
## 2 0.8800000 0.7500     0   0.96
## 3 0.8666667 0.7500     0   0.96
## 4 0.8666667 0.7500     0   0.96
## 5 0.8400000 0.7500     0   0.96
## 6 0.8533333 0.8125     0   0.96
## 
## $`Suitability Class`
##   CFragm CECc pHH2O SoilTe
## 1     S1   S1     N     S1
## 2     S1   S1     N     S1
## 3     S1   S1     N     S1
## 4     S1   S1     N     S1
## 5     S1   S1     N     S1
## 6     S1   S1     N     S1
## 
## $`Factors' Minimum Values`
## CFragm   CECc  pHH2O SoilTe 
##      0      0      0      0 
## 
## $`Factors' Maximum Values`
## CFragm   CECc  pHH2O SoilTe 
##  75.00  16.00   8.94  12.50 
## 
## $`Factors' Weights`
## [1] 3 3 3 2
## 
## $`Crop Evaluated`
## [1] "BANANASoil"
## 
## $Warning
## [1] "maximum is set to 16 for factor CECc since all parameter intervals are equal."

Only the head (first six) of the output of the items in the soil characteristics are shown.

Membership Function

There are three membership functions (MFs) available in the suit function, namely triangular, trapezoidal and Gaussian. For example, the following computes the suitability scores and classes using trapezoidal MF.

banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal")
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
##   CFragm   CECc pHH2O SoilTe
## 1      1 0.7500     0      1
## 2      1 0.7500     0      1
## 3      1 0.7500     0      1
## 4      1 0.7500     0      1
## 5      1 0.7500     0      1
## 6      1 0.8125     0      1
head(banana_suit[["soil"]][["Suitability Class"]])
##   CFragm CECc pHH2O SoilTe
## 1     S1   S1     N     S1
## 2     S1   S1     N     S1
## 3     S1   S1     N     S1
## 4     S1   S1     N     S1
## 5     S1   S1     N     S1
## 6     S1   S1     N     S1

Intervals

Another option available in the suit function is the interval. By default, ALUES uses an equally spaced suitability class intervals for deriving the suitability class. That is, for N [0, 0.25), S3 [0.25, 0.50), S2 [0.50, 0.75), and S1 [0.75, 1].

Custom Intervals

Users can modify the default equally spaced intervals, for example:

banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal", interval=c(0, 0.3, 0.6, 0.9, 1))
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
##   CFragm   CECc pHH2O SoilTe
## 1      1 0.7500     0      1
## 2      1 0.7500     0      1
## 3      1 0.7500     0      1
## 4      1 0.7500     0      1
## 5      1 0.7500     0      1
## 6      1 0.8125     0      1
head(banana_suit[["soil"]][["Suitability Class"]])
##   CFragm CECc pHH2O SoilTe
## 1     S1   S2     N     S1
## 2     S1   S2     N     S1
## 3     S1   S2     N     S1
## 4     S1   S2     N     S1
## 5     S1   S2     N     S1
## 6     S1   S2     N     S1

The above code sets the new suitability class intervals into: N [0, 0.3), S3 [0.3, 0.6), S2 [0.6, 0.9), and S1 [0.9, 1].

Unbias Intervals

The problem with the fixed interval is that the said intervals does not take into account the shape of the membership function and the spacing of the parameter interval limits (See Article 2 for parameter intervals). Custom intervals might be able to capture this if the user computed the interval limits manually, but ALUES provides an option just for this, by setting interval="unbias". That is,

banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal", interval="unbias")
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
head(banana_suit[["soil"]][["Suitability Score"]])
##   CFragm   CECc pHH2O SoilTe
## 1      1 0.7500     0      1
## 2      1 0.7500     0      1
## 3      1 0.7500     0      1
## 4      1 0.7500     0      1
## 5      1 0.7500     0      1
## 6      1 0.8125     0      1
head(banana_suit[["soil"]][["Suitability Class"]])
##   CFragm CECc pHH2O SoilTe
## 1     S1    N     N     S1
## 2     S1    N     N     S1
## 3     S1    N     N     S1
## 4     S1    N     N     S1
## 5     S1    N     N     S1
## 6     S1    N     N     S1

By setting the interval="unbias", the suit function will generate a different likely unequally spaced suitability class intervals, but the interval limits are mathematically correct, in terms of the mapping of the parameter interval limits to suitability class limits via the membership function.

Maximum and Minimum

Another parameter that can be set for suit are the minimum and maximum. These are the constants used by the membership function for computing the suitability score.

banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal", interval="unbias")
## Warning in suitability(terrain, crop_soil, mf = mf, sow_month = NULL, minimum
## = minimum, : maximum is set to 16 for factor CECc since all parameter intervals
## are equal.
banana_suit[["soil"]][["Factors Evaluated"]]
## [1] "CFragm" "CECc"   "pHH2O"  "SoilTe"

From the above result, there are four factors targetted by the input land unit, these are CFragm, CECc, pHH2O and SoilTe. Suppose we know the maximum value that these factors can take, say 60 for CFragm, 20 for CECc, 9 for pHH2O, and 10 for SoilTe. We can specify these as follows:

banana_suit <- suit("banana", terrain=MarinduqueLT, mf="trapezoidal", interval="unbias", maximum=c(60, 20, 9, 10))
banana_suit
## $terrain
## [1] "Error: No factor(s) to be evaluated, since none matches with the crop requirements. If water or temp characteristics was specified then maybe you forgot to specify the sow_month argument, read doc for suit."
## 
## $soil
## [1] "Error: maximum length should be equal to the number of factors in the input land units."

The result gave us an error. We understand the error for terrain characteristics, but for soil it says the argument maximum must be equal in length with the target factors specified in the input land units dataset. We know that there should be 4 factors, but upon checking we see that the MarinduqueLT also have Lon and Lat columns, which ALUES assumes to be a target factor as well. Indeed, we need to exclude these columns (those that are not the target factors) when specifying minimum or maximum constants. Thus, it should be:

MarinduqueLT2 <- MarinduqueLT[, 3:ncol(MarinduqueLT)]
banana_suit <- suit("banana", terrain=MarinduqueLT2, mf="trapezoidal", interval="unbias", maximum=c(60, 20, 9, 10))
head(banana_suit[["soil"]][["Suitability Score"]])
##   CFragm   CECc pHH2O SoilTe
## 1      0 0.7500     0      0
## 2      1 0.7500     0      0
## 3      0 0.7500     0      0
## 4      0 0.7500     0      0
## 5      0 0.7500     0      0
## 6      0 0.8125     0      0
head(banana_suit[["soil"]][["Suitability Class"]])
##   CFragm CECc pHH2O SoilTe
## 1      N    N     N      N
## 2     S1    N     N      N
## 3      N    N     N      N
## 4      N    N     N      N
## 5      N    N     N      N
## 6      N    N     N      N

Sigma of Gaussian

The sigma argument is used to specify scale of the Gaussian membership function. That is, it is only applicable for mf="gaussian".