ALUES: Agricultural Land Use Evaluation System, R package
[This article was first published on Analysis with Programming, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Authors:
Arnold R. Salvacion
arsalvacion@gmail.com
Data Analysis and Visualization using R (blog)
Al-Ahmadgaid B. Asaad (maintainer)
alstated@gmail.com
Agricultural Land Use Evaluation System (ALUES) is an R package that evaluates land suitability for different crop production. The package is based on the Food and Agriculture Organization (FAO) and the International Rice Research Institute (IRRI) methodology for land evaluation. Development of ALUES is inspired by similar tool for land evaluation, Land Use Suitability Evaluation Tool (LUSET). The package uses fuzzy logic approach to evaluate land suitability of a particular area based on inputs such as rainfall, temperature, topography, and soil properties. The membership functions used for fuzzy modeling are the following: Triangular, Trapezoidal and Gaussian. The methods for computing the overall suitability of a particular area are also included, and these are the Minimum, Maximum, Product, Sum, Average, Exponential and Gamma. Finally, ALUES uses the power of Rcpp library for efficient computation.
We want to hear some feedbacks, and if you have any suggestion or issues regarding this package, please do submit it here.
The complete list of factors is available in the pdf version.
From the table, the codes are suffixed with the land units’ characteristics (
For required characteristics of soil, water and temperature on cultivating coconut the codes are
Output
The function returns the following output:
Before we run the function, let’s check for the possible output. From the land units (
Extract the first 6 of the outputs,
Indeed, just what we argued earlier.
Options for
The membership function is an option for the type of fuzzy model, the available models are the following:
Options for
The
To illustrate this, we will test the land units of Marinduque for the required water and temperature for rainfed bunded rice. Thus, we have
We will test first the land units for water, and here are the following water requirements for rainfed bunded rice,
The factors to be evaluated here are the following:
You will have this error if there is no factors to be evaluated. What just happened here is that, the function assumed the data as neither water nor temperature characteristics. Thus, it ignores the
The first land unit for November does confirms to be S1, but for December it isn’t, and instead S2 is given. This problem will be discussed later on details about the
Options for
By default,
Now let’s try different minimums for factors, we will use the following:
So we got an error, it is expected, since the length of the vector
Only CECc and SoilTe are returned since these are the factors evaluated.
Options for
By default
For different maximum value on every factor, we will use the following and ommit the first two factors in
Options for
The domain of suitability scores are set to default,
An example of
Given that the starting sowing month assigned is November, then the following factors are evaluated:
The suitability scores and class of this would be,
Focus your attention on suitability scores of
Then it is easy to pin point what suitability class does the scores of the land units falls into. Which follows that all first three land units falls within class S1. See the problem with
Assigning new values for parameters of the
And that supports our argument above.
Weighting
The function,
The weights are assigned on the last column,
If a given factor has a weight, then the function will compute the corresponding suitability and then use the weighting score to obtain the appropriate suitability score. The weights of the factors for the default interval (
Thus the function simply divides the interval of the suitability class into three, for three weights.
And here are the required values for factors of soil, terrain, temperature and water characteristics for irrigated rice,
Now, we are going to take the suitability scores for every characteristics,
Next, we will take the overall suitability on all factors in each land unit using the
Finally, take the overall suitability from these characteristics using the
Arnold R. Salvacion
arsalvacion@gmail.com
Data Analysis and Visualization using R (blog)
Al-Ahmadgaid B. Asaad (maintainer)
alstated@gmail.com
Agricultural Land Use Evaluation System (ALUES) is an R package that evaluates land suitability for different crop production. The package is based on the Food and Agriculture Organization (FAO) and the International Rice Research Institute (IRRI) methodology for land evaluation. Development of ALUES is inspired by similar tool for land evaluation, Land Use Suitability Evaluation Tool (LUSET). The package uses fuzzy logic approach to evaluate land suitability of a particular area based on inputs such as rainfall, temperature, topography, and soil properties. The membership functions used for fuzzy modeling are the following: Triangular, Trapezoidal and Gaussian. The methods for computing the overall suitability of a particular area are also included, and these are the Minimum, Maximum, Product, Sum, Average, Exponential and Gamma. Finally, ALUES uses the power of Rcpp library for efficient computation.
INSTALLATION
The package is not yet on CRAN, and is currently under development on github. To install it, run the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages('devtools') | |
library(devtools) | |
install_github(repo = 'ALUES', username = 'alstat') |
DATASET
The package contains several datasets which can be categorized into two:- Land Units’ Attributes – datasets that contain the attributes of the land units of a given location.
- Crop Requirements – datasets that contain the required values of factors of a particular crop for the land units.
Land Units’ Attributes
The package contains sample dataset of land units’ attributes from two countries:- Marinduque, Philippines:
-
MarinduqueLT
– a dataset consisting the land and terrain characteristics of the land units of Marinduque, Philippines; MarinduqueTemp
– a dataset consisting the temperature characteristics of the land units of Marinduque, Philippines; andMarinduqueWater
– a dataset consisting the water characteristics of the land units of Marinduque, Philippines.
-
- Lao Cai, Vietnam
LaoCaiLT
– a dataset consisting the land and terrain characteristics of the land units of Lao Cai, Vietnam;LaoCaiTemp
– a dataset consisting the temperature characteristics of the land units in Lao Cai, Vietnam;LaoCaiWater
– a dataset consisting the water characteristics of the land units of Lao Cai, Vietnam;
MarinduqueLT
is shown below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head(ALUES::MarinduqueLT) | |
#OUTPUT | |
X Y CECc pHH20 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 |
Crop Requirements
The crops available in the package are the listed in Table 1.Code | Crops | ||
---|---|---|---|
Table 1: Crops Dataset Available in ALUES. | |||
BANANA- | Banana | ||
CASSAVA- | Cassava | ||
COCOA- | Cocoa | ||
COCONUT- | Coconut | ||
COFFEEAR- | Arabica Coffee | ||
COFFEERO- | Robusta Coffee | ||
RICEBR- | Rainfed Bunded Rice | ||
RICEIW- | Irrigated Rice | ||
RICENF- | Rice Cultivation Under Natural Floods | ||
RICEUR- | Rainfed Upland Rice |
From the table, the codes are suffixed with the land units’ characteristics (
TerrainCR
, SoilCR
, WaterCR
and TemperatureCR
) required for the crop. For example, below are the required values for the terrain characteristics of the land units on cultivating coconut:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALUES::COCONUTTerrainCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 Slope1 6 4 2 NA NA NA NA | |
2 Slope2 16 8 4 NA NA NA NA | |
3 Slope3 30 16 8 NA NA NA NA | |
4 Flood 2 1 1 NA NA NA NA | |
5 Drainage 3 3 2 NA NA NA NA |
COCONUTSoilCR
, COCONUTWaterCR
and COCONUTTemperatureCR
, respectively. R FUNCTIONS
The package contains the following functions:suitability
– computes the suitability scores and classes of the land units base on the requirements of the crop.overall_suit
– computes the overall suitability of the land units, using the suitability scores obtained from thesuitability
function.
Suitability
In this section, we will get into the details of thesuitability
function. Usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suitability(x, y, mf = "triangular", sow.month = NULL, min = NULL, | |
max = "average", interval = "fixed") |
x | a data frame consisting the properties of the land units; |
y | a data frame consisting the crop (e.g. coconut, cassava, etc.) requirements for a given characteristics (terrain, soil, water and temperature); |
mf | membership function, default is set to "triangular" . Other fuzzy models are "Trapezoidal" and "Gaussian" . |
sow.month | sowing month of the crop. Takes integers from 1 to 12 (inclusive), representing the twelve months of a year. So if sets to 1, the function assumes sowing month on January. |
min | factor’s minimum value. If NULL (default), min is set to 0. But if numeric of length one, say 0.5, then minimum is set to 0.5 for all factors. If factors on land units (x ) have different minimum, then these can be concatenated to vector of min s, the length of this vector should be equal to the number of factors in x . However, if sets to "average" , then min is theoretically computed as:Let X be a factor, then X has the following suitability class: S3, S2 and S1. Assuming the scores of the said suitability class for X are $a, b$ and $c$, respectively. Then, $$mathrm{min} = a – displaystylefrac{(b – a) + (c – b)}{2}$$ For factors with suitability class S3, S2, S1, S1, S2 and S3 with scores $a, b, c, d, e$ and $f$, respectively. min is computed as, $$mathrm{min} = a – displaystylefrac{(b – a) + (c – b) + (d – c) + (e – d) + (f – e)}{5}$$ |
max | factor’s maximum value. Default is set to "average" . If numeric of length one, say 50, then maximum is set to 50 for all factors. If factors on land units (x ) have different maximum, then these can be concatenated to vector of max s, the length of this vector should be equal to the number of factors in x . However, if sets to "average" , then max is computed from the equation below: $$mathrm{max}=c + displaystylefrac{(b-a) + (c-b)}{2}$$ For factors with suitability class S3, S2, S1, S1, S2 and S3 with scores $a, b, c, d, e$ and $f$, respectively. Then, $$mathrm{max} = f + displaystylefrac{(b – a) + (c – b) + (d – c) + (e – d) + (f – e)}{5}$$ |
interval | domain for every suitability class (S1, S2, S3, and N). If "fixed" , the interval would be 0 to 0.25 for N (Not Suitable), 0.25 to 0.50 for S3 (Marginally Suitable), 0.50 to 0.75 for S2 (Moderately Suitable), and 0.75 to 1 for (Highly Suitable). If "unbias" , then the interval is set to 0 to $displaystylefrac{a}{mathrm{max}}$ for N, $displaystylefrac{a}{mathrm{max}}$ to $displaystylefrac{b}{mathrm{max}}$ for S3, $displaystylefrac{b}{mathrm{max}}$ to $displaystylefrac{c}{mathrm{max}}$ for S2, and $displaystylefrac{c}{mathrm{max}}$ to $displaystylefrac{mathrm{max}}{mathrm{max}}$ for S1. |
Output
The function returns the following output:
- Actual Factors Evaluated;
- Suitability Score;
- Suitability Class;
- Factors’ Minimum Values; and,
- Factors’ Maximum Values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First 6 of the Marinduque land units | |
# soil and terrain properties | |
head(ALUES::MarinduqueLT) | |
#OUTPUT | |
X Y CECc pHH20 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 | |
# Soil characteristics of the coconut | |
# from FAO standards | |
ALUES::COCONUTSoilCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 CFragm 55.0 35.0 15.0 NA NA NA NA | |
2 SoilDpt 50.0 75.0 100.0 NA NA NA NA | |
3 BS 19.9 19.9 20.0 NA NA NA NA | |
4 SumBCs 1.5 1.5 1.6 NA NA NA NA | |
5 OC 0.7 0.7 0.8 NA NA NA NA | |
6 ECemh 20.0 16.0 12.0 NA NA NA NA |
MarinduqueLT
), the only factor available to be evaluated is CFragm
, for required soil characteristics of the coconut. The first land unit has 11% coarse fragment (CFragm), which falls within the S1 domain of the required soil characteristics, with domain [min
– 15%), where min
has default value set to 0. The second to sixth land units also are highly suitable as it falls within the said domain. Let’s confirm it using the function,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ALUES) | |
coco_suit_soil <- suitability(x = MarinduqueLT, y = COCONUTSoilCR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lapply(coco_suit_soil, function(x) head(x, n = 6)) | |
#OUTPUT | |
$`Actual Factors Evaluated` | |
[1] "CFragm" | |
$`Suitability Score` | |
CFragm | |
1 0.8533333 | |
2 0.8800000 | |
3 0.8666667 | |
4 0.8666667 | |
5 0.8400000 | |
6 0.8533333 | |
$`Suitability Class` | |
CFragm | |
1 S1 | |
2 S1 | |
3 S1 | |
4 S1 | |
5 S1 | |
6 S1 | |
$`Factors' Minimum Values` | |
CFragm | |
0 | |
$`Factors' Maximum Values` | |
CFragm | |
75 |
Options for
mf
(Membership Function)The membership function is an option for the type of fuzzy model, the available models are the following:
- Triangular;
- Trapezoidal; and,
- Gaussian.
Options for
sow.month
(Sowing Month)The
sow.month
is the sowing month which takes integers from 1 to 12, representing the twelve months of a year. So if sets to 1, the function assumes sowing month on January. This argument is only use for water and temperature characteristics.To illustrate this, we will test the land units of Marinduque for the required water and temperature for rainfed bunded rice. Thus, we have
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ALUES) | |
# Water Characteristics of Marinduque land units | |
head(MarinduqueWater) | |
#OUTPUT | |
X Y Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec | |
1 121.8792 13.52084 103 65 55 62 136 197 221 191 199 308 277 248 | |
2 121.8875 13.52084 104 65 55 61 135 196 220 190 197 307 276 247 | |
3 121.8958 13.52084 104 66 56 61 134 195 218 187 195 306 275 247 | |
4 121.9375 13.52084 105 65 57 59 131 195 218 189 195 308 273 245 | |
5 121.9458 13.52084 105 65 58 59 131 196 219 190 196 309 272 245 | |
6 121.9542 13.52084 106 66 59 57 128 191 210 179 185 302 268 241 | |
# Temperature Characteristics of Marinduque land units | |
head(MarinduqueTemp) | |
#OUTPUT | |
X Y Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec | |
1 121.8792 13.52084 24.7 25.1 25.9 27.1 27.7 27.4 26.8 26.8 26.7 26.3 25.9 25.1 | |
2 121.8875 13.52084 24.8 25.0 26.0 27.2 27.8 27.5 26.8 26.8 26.6 26.5 26.0 25.3 | |
3 121.8958 13.52084 24.9 25.2 26.1 27.3 27.9 27.6 26.9 27.0 26.8 26.6 26.2 25.4 | |
4 121.9375 13.52084 24.7 25.1 26.0 27.2 27.7 27.5 26.8 26.8 26.6 26.5 26.0 25.3 | |
5 121.9458 13.52084 24.7 25.1 25.9 27.0 27.7 27.4 26.8 26.8 26.6 26.4 26.0 25.2 | |
6 121.9542 13.52084 25.0 25.5 26.4 27.5 28.2 27.9 27.4 27.3 27.2 26.9 26.4 25.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RICEBRWaterCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 WmAv1 100.00 125.00 175.00 500 650 750 NA | |
2 WmAv2 100.00 125.00 175.00 500 650 750 NA | |
3 WmAv3 100.00 125.00 175.00 500 650 750 NA | |
4 WmAv4 29.00 30.00 50.00 300 500 600 NA | |
5 WmhAv2 30.00 40.00 50.00 90 NA NA NA | |
6 WmhAv4 29.90 30.00 33.00 80 NA NA NA | |
7 WynN 0.44 0.45 0.65 NA NA NA NA |
WmAv1
– Mean precipitation of first month (mm);WmAv2
– Mean precipitation of second month (mm);WmAv3
– Mean precipitation of third month (mm); andWmAv4
– Mean precipitation of fourth month (mm).
WmAv1
– November;WmAv2
– December;WmAv3
– January; andWmAv4
– February.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rice_suit_water <- suitability(x = MarinduqueWater, y = RICEBRWaterCR) | |
#OUTPUT | |
Error in suitability(x = MarinduqueWater, y = RICEBRWaterCR) : | |
No factor(s) to be evaluated, since none matches with the crop requirements. | |
In addition: Warning message: | |
In suitability(x = MarinduqueWater, y = RICEBRWaterCR) : | |
For water characteristic, make sure to input sowing month (sow.month), say 1, w/c implies January |
WmAv1
, WmAv2
, WmAv3
and WmAv4
factors. But if we specify the sowing month (sow.month
) to November (11
), then we have
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rice_suit_water <- suitability( | |
x = MarinduqueWater, y = RICEBRWaterCR, sow.month = 11 | |
) | |
lapply(rice_suit_water, function(x) head(x, n = 6)) | |
#OUTPUT | |
$`Actual Factors Evaluated` | |
[1] "Nov" "Dec" "Jan" "Feb" | |
$`Suitability Score` | |
Nov Dec Jan Feb | |
1 0.8207407 0.7348148 0.3051852 0.3714286 | |
2 0.8177778 0.7318519 0.3081481 0.3714286 | |
3 0.8148148 0.7318519 0.3081481 0.3771429 | |
4 0.8088889 0.7259259 0.3111111 0.3714286 | |
5 0.8059259 0.7259259 0.3111111 0.3714286 | |
6 0.7940741 0.7140741 0.3140741 0.3771429 | |
$`Suitability Class` | |
Nov Dec Jan Feb | |
1 S1 S2 S3 S3 | |
2 S1 S2 S3 S3 | |
3 S1 S2 S3 S3 | |
4 S1 S2 S3 S3 | |
5 S1 S2 S3 S3 | |
6 S1 S2 S3 S3 | |
$`Factors' Minimum Values` | |
Nov Dec Jan Feb | |
0 0 0 0 | |
$`Factors' Maximum Values` | |
Nov Dec Jan Feb | |
880.0 880.0 880.0 714.2 |
interval
argument.Options for
min
(Factors’ Minimum Value)By default,
min = 0
for all factors. This can be assigned to any positive integers, for example, using the cassava soil requirements,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default min = 0 | |
cassava_suit_soil <- suitability(x = MarinduqueLT, y = CASSAVASoilCR) | |
cassava_suit_soil$`Factors' Minimum Values` | |
#OUTPUT | |
CECc SoilTe | |
0 0 | |
# Change min = 1 | |
cassava_suit_soil <- suitability( | |
x = MarinduqueLT, y = CASSAVASoilCR, min = 1 | |
) | |
cassava_suit_soil$`Factors' Minimum Values` | |
#OUTPUT | |
CECc SoilTe | |
1 1 | |
# Change min = 2 | |
cassava_suit_soil <- suitability( | |
x = MarinduqueLT, y = CASSAVASoilCR, min = 2 | |
) | |
cassava_suit_soil$`Factors' Minimum Values` | |
#OUTPUT | |
CECc SoilTe | |
2 2 |
CECc | pHH20 | CFragm | SoilTe |
---|---|---|---|
Table 2: Custom min . | |||
0.4 | 0.6 | 0.1 | 0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minimum <- c(0.4, 0.6, 0.1, 0.3) | |
# Use these minimum | |
cassava_suit_soil <- suitability( | |
x = MarinduqueLT, y = CASSAVASoilCR, min = minimum | |
) | |
#OUTPUT | |
Error in suitability(x = MarinduqueLT, y = CASSAVASoilCR, min = minimum) : | |
min length should be equal to the number of factors in x. |
min
should be equal to the number of factors in x
, which is 6. Since we are not interested on the latitude (X
) and longitude (Y
) factors of the dataset, then we can ommit the two and rerun the code,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cassava_suit_soil <- suitability( | |
x = MarinduqueLT[, -(1:2)], y = CASSAVASoilCR, min = minimum | |
) | |
cassava_suit_soil$`Factors' Minimum Values` | |
#OUTPUT | |
CECc SoilTe | |
0.4 0.3 |
Options for
max
(Factors’ Maximum Value)By default
max = 'average'
, and just like min
, max
can be assigned to any positive integer, example:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default max = 'average' | |
cassava_suit_soil <- suitability(x = MarinduqueLT, y = CASSAVASoilCR) | |
cassava_suit_soil$`Factors' Maximum Values` | |
#OUTPUT | |
CECc SoilTe | |
16.05 12.00 | |
# Change max = 110 | |
cassava_suit_soil <- suitability( | |
x = MarinduqueLT, y = CASSAVASoilCR, max = 110 | |
) | |
cassava_suit_soil$`Factors' Maximum Values` | |
#OUTPUT | |
CECc SoilTe | |
110 110 |
MarinduqueLT
like what we did in the previous section.CECc | pHH20 | CFragm | SoilTe |
---|---|---|---|
Table 3: Custom max . | |||
52.5 | 8.8 | 40 | 14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maximum <- c(52.5, 8.8, 40, 14) | |
banana_suit_soil <- suitability( | |
x = MarinduqueLT[, -(1:2)], y = CASSAVASoilCR, max = maximum | |
) | |
banana_suit_soil$`Factors' Maximum Values` | |
#OUTPUT | |
CECc SoilTe | |
52.5 14.0 |
interval
(Domain of Suitability Scores)The domain of suitability scores are set to default,
'fixed'
, if this option is used, the domain of the suitability scores would be,Class | N | S3 | S2 | S1 |
---|---|---|---|---|
Table 4: Domain for 'fixed' . | ||||
Domain | [0, 0.25) | [0.25, 0.5) | [0.5, 0.75) | [0.75, 1] |
An example of
interval = 'fixed'
is the one illustrated in Options for sow.month
(Sowing Month) above. Let us investigate the output of that, here is the crop requirements for water (the crop we are interested in, is the rainfed bunded rice),
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RICEBRWaterCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 WmAv1 100.00 125.00 175.00 500 650 750 NA | |
2 WmAv2 100.00 125.00 175.00 500 650 750 NA | |
3 WmAv3 100.00 125.00 175.00 500 650 750 NA | |
4 WmAv4 29.00 30.00 50.00 300 500 600 NA | |
5 WmhAv2 30.00 40.00 50.00 90 NA NA NA | |
6 WmhAv4 29.90 30.00 33.00 80 NA NA NA | |
7 WynN 0.44 0.45 0.65 NA NA NA NA |
WmAv1
– November;WmAv2
– December;WmAv3
– January; andWmAv4
– February.
MarinduqueWater
,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head(MarinduqueWater[c(13, 14, 3, 4)]) | |
#OUTPUT | |
Nov Dec Jan Feb | |
1 277 248 103 65 | |
2 276 247 104 65 | |
3 275 247 104 66 | |
4 273 245 105 65 | |
5 272 245 105 65 | |
6 268 241 106 66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head(rice_suit_water[[2]]) | |
#OUTPUT | |
Nov Dec Jan Feb | |
1 0.8207407 0.7348148 0.3051852 0.3714286 | |
2 0.8177778 0.7318519 0.3081481 0.3714286 | |
3 0.8148148 0.7318519 0.3081481 0.3771429 | |
4 0.8088889 0.7259259 0.3111111 0.3714286 | |
5 0.8059259 0.7259259 0.3111111 0.3714286 | |
6 0.7940741 0.7140741 0.3140741 0.3771429 | |
head(rice_suit_water[[3]]) | |
#OUTPUT | |
Nov Dec Jan Feb | |
1 S1 S2 S3 S3 | |
2 S1 S2 S3 S3 | |
3 S1 S2 S3 S3 | |
4 S1 S2 S3 S3 | |
5 S1 S2 S3 S3 | |
6 S1 S2 S3 S3 |
Feb
factor for the first three land units. We have here 0.3714, 0.3714 and 0.3771. And the domain of this base on Table 4, would be S3, S3 and S3. But, if we refer to the original data, the first three data points in Feb
factor are all 65. Since WmAv4
is the corresponding requirements for Feb
factor, with scores:Factor | S3 | S2 | S1 | S1 | S2 | S3 | Weight |
---|---|---|---|---|---|---|---|
Table 5: WmAv4 ’s Suitability Requirements. | |||||||
WmAv4 | 29 | 30 | 50 | 300 | 500 | 600 | NA |
Then it is easy to pin point what suitability class does the scores of the land units falls into. Which follows that all first three land units falls within class S1. See the problem with
'fixed'
interval? This is the same problem for other factor like Dec
(December), where instead of S1, we got S2. Users can change the domain though, that is, instead of using the 'fixed'
option, users can assign for example, interval = c(0, 0.33, 0.56, 0.89, 1)
, which equivalently:Class | N | S3 | S2 | S1 |
---|---|---|---|---|
Table 6: Custom Domains. | ||||
Domain | [0, 0.33) | [0.33, 0.56) | [0.56, 0.89) | [0.89, 1] |
Assigning new values for parameters of the
interval
won’t solve the problem, but this argument has one more option to offer, which does solve the problem, and that is by changing interval = 'fixed'
to interval = 'unbias'
. Let’s try it,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rice_suit_water <- suitability( | |
x = MarinduqueWater, y = RICEBRWaterCR, sow.month = 11, interval = 'unbias' | |
) | |
lapply(rice_suit_water, function(x) head(x, n = 6)) | |
#OUTPUT | |
$`Actual Factors Evaluated` | |
[1] "Nov" "Dec" "Jan" "Feb" | |
$`Suitability Score` | |
Nov Dec Jan Feb | |
1 0.8207407 0.7348148 0.3051852 0.3714286 | |
2 0.8177778 0.7318519 0.3081481 0.3714286 | |
3 0.8148148 0.7318519 0.3081481 0.3771429 | |
4 0.8088889 0.7259259 0.3111111 0.3714286 | |
5 0.8059259 0.7259259 0.3111111 0.3714286 | |
6 0.7940741 0.7140741 0.3140741 0.3771429 | |
$`Suitability Class` | |
Nov Dec Jan Feb | |
1 S1 S1 S3 S1 | |
2 S1 S1 S3 S1 | |
3 S1 S1 S3 S1 | |
4 S1 S1 S3 S1 | |
5 S1 S1 S3 S1 | |
6 S1 S1 S3 S1 | |
$`Factors' Minimum Values` | |
Nov Dec Jan Feb | |
0 0 0 0 | |
$`Factors' Maximum Values` | |
Nov Dec Jan Feb | |
880.0 880.0 880.0 714.2 |
Weighting
The function,
suitability
, also considers the weights of the factors. An example of crop with no weights is the soil requirement for coconut,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALUES::COCONUTSoilCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 CFragm 55.0 35.0 15.0 NA NA NA NA | |
2 SoilDpt 50.0 75.0 100.0 NA NA NA NA | |
3 BS 19.9 19.9 20.0 NA NA NA NA | |
4 SumBCs 1.5 1.5 1.6 NA NA NA NA | |
5 OC 0.7 0.7 0.8 NA NA NA NA | |
6 ECemh 20.0 16.0 12.0 NA NA NA NA |
Weight.class
. And here is the soil requirements for the cassava, with weight on each factor:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALUES::CASSAVASoilCR | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 CFragm1 35.0 15.0 3.0 NA NA NA 2 | |
2 CFragm2 55.0 35.0 15.0 NA NA NA 3 | |
3 SoilDpt 50.0 75.0 100.0 NA NA NA 2 | |
4 CaCO3 10.0 5.0 1.0 NA NA NA 3 | |
5 Gyps 2.0 1.0 0.2 NA NA NA 3 | |
6 CECc 15.9 15.9 16.0 NA NA NA 3 | |
7 BS 20.1 20.1 20.0 NA NA NA 3 | |
8 SumBCs 2.1 2.1 2.0 NA NA NA 3 | |
9 pHH2O 4.5 4.8 5.2 7 7.6 8.2 3 | |
10 OC 0.9 0.9 0.8 NA NA NA 3 | |
11 ECedS 4.0 3.0 2.0 NA NA NA 3 | |
12 SoilTe 3.0 4.0 9.0 NA NA NA 2 |
interval = 'fixed'
) are in Table 7:Suitability | Factor Weights | ||
---|---|---|---|
Table 7: Weights of the Factors for 'fixed' Interval. | |||
Class | 1 | 2 | 3 |
S1 | 0.833 | 0.916 | 1.000 |
S2 | 0.583 | 0.667 | 0.750 |
S3 | 0.333 | 0.416 | 0.500 |
N | 0.083 | 0.167 | 0.250 |
Thus the function simply divides the interval of the suitability class into three, for three weights.
Overall Suitability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
overall_suit(x, method = NULL, interval = NULL, output = NULL) |
x | a data frame consisting the suitability scores of a given characteristics (terrain, soil, water and temperature) for a given crop (e.g. coconut, cassava, etc.); |
method | the method for computing the overall suitability, which includes the minimum, maximum, sum, product, average, exponential and gamma. If NULL , minimum is used. |
interval | if NULL , the interval used are the following: 0-0.25 (Not suitable, N), 0.25-0.50 (Marginally Suitable, S3), 0.50-0.75 (Moderately Suitable, S2), and 0.75-1 (Highly Suitable, S1). |
output | the output to be returned, either the scores or class. If NULL , both are returned. |
DEMONSTRATION
Let’s assume we are interested on the land units in Lao Cai, Vietnam, for cultivating irrigated rice. So here are the first 6 land units in the said location,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ALUES) | |
head(LaoCaiLT) # Land and Terrain Characteristics | |
#OUTPUT | |
SlopeD CFragm SoilDpt SoilTe CECc SumBCs pHH2O BS OC Flood | |
1 1 0 45 9 18.6 3.30 5.4 50.00 1.40 3 | |
2 1 0 45 9 18.6 3.30 5.4 50.00 1.40 3 | |
3 1 0 45 9 18.6 3.30 5.4 50.00 1.40 3 | |
4 1 0 45 9 18.6 3.30 5.4 50.00 1.40 3 | |
5 1 0 45 9 18.6 3.30 5.4 50.00 1.40 3 | |
6 1 5 65 3 19.8 3.13 5.3 34.72 1.21 2 | |
head(LaoCaiTemp) # Temperature Characteristics | |
#OUTPUT | |
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec | |
1 11.19 12.55 16.34 19.96 22.68 23.67 23.84 23.28 22.01 19.46 15.85 12.46 | |
2 12.04 13.32 17.10 20.26 22.35 23.29 23.37 23.04 21.91 19.50 15.99 13.02 | |
3 12.27 13.53 17.30 20.47 22.64 23.58 23.64 23.29 22.16 19.77 16.23 13.24 | |
4 15.91 16.11 20.09 23.01 25.95 27.50 27.04 26.64 25.27 23.33 19.36 16.73 | |
5 15.39 15.76 19.70 22.67 25.50 26.93 26.55 26.16 24.83 22.83 18.92 16.22 | |
6 13.13 14.28 18.06 21.13 23.40 24.37 24.32 23.97 22.85 20.58 16.96 13.98 | |
head(LaoCaiWater) # Water Characteristics | |
#OUTPUT | |
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Irrigation | |
1 20.49 32.77 47.80 124.15 177.86 268.30 340.59 367.60 237.65 123.71 65.80 20.48 1 | |
2 35.71 50.45 73.00 155.55 261.88 341.18 409.60 411.93 261.33 136.69 75.82 31.68 1 | |
3 33.63 47.38 71.10 151.62 250.26 331.67 402.74 404.63 252.57 128.94 73.43 29.21 1 | |
4 20.74 27.21 96.28 132.81 184.52 191.73 339.20 352.97 229.90 76.14 79.89 12.06 1 | |
5 22.17 29.49 91.25 134.45 191.33 212.30 347.35 358.54 229.35 81.75 77.71 14.03 1 | |
6 30.17 41.50 72.47 147.04 231.12 311.19 389.64 389.49 231.29 108.18 69.60 23.80 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RICEIWTerrainCR # Terrain Characteristics | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 Slope1 4 2 1 NA NA NA NA | |
2 Flood 1 2 3 NA NA NA 1 | |
3 Drainage 5 4 2 NA NA NA 2 | |
4 SlopeD 3 2 1 NA NA NA 1 | |
RICEIWSoilCR # Soil Characteristics | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 CFragm 35.0 15.0 3.0 NA NA NA 3 | |
2 SoilDpt 20.0 50.0 75.0 NA NA NA 3 | |
3 CaCO3 25.0 15.0 6.0 NA NA NA 3 | |
4 Gyps 25.0 10.0 3.0 NA NA NA 3 | |
5 CECc 10.0 12.0 16.0 NA NA NA 3 | |
6 BS 20.0 35.0 50.0 NA NA NA 2 | |
7 SumBCs 1.6 2.8 4.0 NA NA NA 3 | |
8 OC 0.7 0.8 1.5 NA NA NA 2 | |
9 ECedS 6.0 4.0 2.0 NA NA NA 3 | |
10 ESP 40.0 30.0 20.0 NA NA NA 3 | |
11 pHH2O 4.5 5.0 5.5 8.2 8.5 8.8 3 | |
12 SoilTe 3.0 4.0 9.0 NA NA NA 2 | |
RICEIWTemperatureCR # Temperature Characteristics | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 TgAv 10 18 24 36 36.1 36.1 1 | |
2 TmMaxXm 21 26 30 40 45.0 50.0 NA | |
3 TmAv2 10 18 24 36 42.0 45.0 2 | |
4 TmMinAv4 7 10 14 25 28.0 30.0 NA | |
RICEIWWaterCR # Water Characteristics | |
#OUTPUT | |
Code S3 S2 S1 S1.1 S2.1 S3.1 Weight.class | |
1 WmAv1 100.00 125.00 175.00 500 650 750 NA | |
2 WmAv2 100.00 125.00 175.00 500 650 750 NA | |
3 WmAv3 100.00 125.00 175.00 500 650 750 NA | |
4 WmAv4 29.00 30.00 50.00 300 500 600 NA | |
5 WmhAv2 30.00 40.00 50.00 90 NA NA NA | |
6 WmhAv4 29.90 30.00 33.00 80 NA NA NA | |
7 WynN 0.44 0.45 0.65 NA NA NA NA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x1 <- LaoCaiLT; y1 <- RICEIWTerrainCR; y2 <- RICEIWSoilCR; | |
x2 <- LaoCaiTemp; y3 <- RICEIWTemperatureCR; | |
x3 <- LaoCaiWater; y4 <- RICEIWWaterCR | |
# Terrain Characteristics | |
riwTerr_suit <- suitability(x = x1, y = y1, interval = "unbias") | |
# Soil Characteristics | |
riwSoil_suit <- suitability(x = x1, y = y2, interval = "unbias") | |
# Temperature Characteristics | |
riwTemp_suit <- suitability( | |
x = x2, y = y3, | |
interval = "unbias", | |
sow.month = 10 | |
) | |
# Water Characteristics | |
riwWatr_suit <- suitability( | |
x = x3, y = y4, | |
interval = "unbias", | |
sow.month = 10 | |
) |
"average"
method (default is "minimum"
).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Terrain Characteristics | |
riwTerr_ovs <- overall_suit(riwTerr_suit[[2]], method = "average") | |
# Soil Characteristics | |
riwSoil_ovs <- overall_suit(riwSoil_suit[[2]], method = "average") | |
# Temperature Characteristics | |
riwTemp_ovs <- overall_suit(riwTemp_suit[[2]], method = "average") | |
# Water Characteristics | |
riwWatr_ovs <- overall_suit(riwWatr_suit[[2]], method = "average") | |
# Combine scores into data frame | |
rFact_ovs1 <- data.frame( | |
"Terrain" = riwTerr_ovs[, 1], | |
"Soil" = riwSoil_ovs[, 1], | |
"Temp" = riwTemp_ovs[, 1], | |
"Water" = riwWatr_ovs[, 1] | |
) | |
# Combine classes into data frame | |
rFact_ovs2 <- data.frame( | |
"Terrain" = riwTerr_ovs[, 2], | |
"Soil" = riwSoil_ovs[, 2], | |
"Temp" = riwTemp_ovs[, 2], | |
"Water" = riwWatr_ovs[, 2] | |
) | |
# Combine the two data frame into a list | |
rFact_ovs <- list("Scores" = rFact_ovs1, "Class" = rFact_ovs2) | |
# Return the first 10 of the output | |
lapply(rFact_ovs, function(x) head(x, n = 10)) | |
#OUTPUT | |
$Scores | |
Terrain Soil Temp Water | |
1 0.8333333 0.4878049 0.4528571 0.06068148 | |
2 0.8333333 0.4878049 0.4568571 0.09386667 | |
3 0.8333333 0.4878049 0.4637143 0.08654815 | |
4 0.8333333 0.4878049 0.5531429 0.03573333 | |
5 0.8333333 0.4878049 0.5405714 0.04157037 | |
6 0.5833333 0.0000000 0.4845714 0.07051852 | |
7 0.5833333 0.0000000 0.4888571 0.06352593 | |
8 0.5833333 0.0000000 0.4885714 0.07004444 | |
9 0.5833333 0.0000000 0.4797143 0.06752593 | |
10 0.5833333 0.0000000 0.5020000 0.05742222 | |
$Class | |
Terrain Soil Temp Water | |
1 S1 S3 S3 N | |
2 S1 S3 S3 N | |
3 S1 S3 S3 N | |
4 S1 S3 S2 N | |
5 S1 S3 S2 N | |
6 S2 N S3 N | |
7 S2 N S3 N | |
8 S2 N S3 N | |
9 S2 N S3 N | |
10 S2 N S2 N |
"maximum"
method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
riw_ovs <- overall_suit(rFact_ovs[[1]], method = "maximum") | |
head(riw_ovs, n = 10) | |
#OUTPUT | |
Scores Class | |
1 0.8333333 S1 | |
2 0.8333333 S1 | |
3 0.8333333 S1 | |
4 0.8333333 S1 | |
5 0.8333333 S1 | |
6 0.5833333 S2 | |
7 0.5833333 S2 | |
8 0.5833333 S2 | |
9 0.5833333 S2 | |
10 0.5833333 S2 |
To leave a comment for the author, please follow the link and comment on their blog: Analysis with Programming.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.