ClimMobTools: API Client for the ‘ClimMob’ platform in R

Overview

ClimMobTools the API Client for the ‘ClimMob’ platform in R. ClimMob is an open source software for for decentralized large-N trials with the ‘tricot’ approach1. The approach aims the rapid assessment of technologies in the target environment. Tricot turns the research paradigm on its head; instead of a few researchers designing complicated trials to compare several technologies in search of the best solutions, it enables many participants to carry out reasonably simple experiments that taken together can offer even more information.

Usage

The breadwheat is a dataframe from crowdsourcing citizen science trials of bread wheat (Triticum aestivum L.) varieties in India. This is a sample data available at the ClimMob that can be fetched using the function getDataCM() from ClimMobTools and an API key from the ClimMob user’s account.

library("ClimMobTools")
library("PlackettLuce")
library("climatrends")
library("nasapower")

# the API key
key <- "d39a3c66-5822-4930-a9d4-50e7da041e77"

dat <- getDataCM(key = key,
                 project = "breadwheat",
                 userowner = "gosset",
                 pivot.wider = TRUE)


names(dat) <- gsub("firstassessment_|package_|lastassessment_|registration_", "",
                   names(dat))

Tricot data with environmental covariates

We can add environmental covariates from package climatrends. Here we use function temperature() to compute the temperature indices for the first 80 days after planting.

dat$plantingdate <- as.Date(dat$plantingdate, format = "%Y-%m-%d")
dat$lon <- as.numeric(dat$farm_geo_longitude)
dat$lat <- as.numeric(dat$farm_geo_latitude)

temp <- temperature(dat[, c("lon","lat")], 
                    day.one = dat[, "plantingdate"],
                    span = 80)

temp
#>      maxDT minDT maxNT minNT   DTR    SU    TR   CFD  WSDI  CSDI  T10p  T90p
#>      <dbl> <dbl> <dbl> <dbl> <int> <int> <int> <int> <int> <int> <dbl> <dbl>
#> 1:   30.75 20.65 17.67  4.63    15     2     0     0     3     2  5.50 27.74
#> 2:   29.15 20.65 16.52  4.63    15     0     0     0     4     2  5.50 27.46
#> 3:   32.76 20.65 18.49  4.63    15     7     0     0     8     2  5.50 29.16
#> 4:   29.15 20.65 16.52  4.63    15     0     0     0     3     2  5.50 27.27
#> 5:   29.15 20.65 16.52  4.63    15     0     0     0     4     2  5.50 26.22
#> ---                                                                         
#> 489: 29.15 20.65 16.52  4.63    15     0     0     0     3     2  5.50 27.27
#> 490: 29.15 20.65 16.52  4.63    15     0     0     0     3     2  5.50 27.27
#> 491: 32.76 20.65 17.67  4.63    15     5     0     0     6     2  5.50 28.41
#> 492: 29.15 20.65 16.52  4.63    15     0     0     0     3     2  5.50 27.27
#> 493: 29.15 20.65 16.52  4.63    15     0     0     0     3     2  5.50 27.27

Tricot data into rankings

The Plackett-Luce model is one approach to analyse the ClimMob data2. We build the farmers’ rankings as an object of class ‘grouped_rankings’. This allows the rankings to be linked to the environmental covariates computed previously and fit the model using pltree() from the package PlackettLuce.

We build the rankings using the function rankTricot().

R <- rankTricot(dat, 
                items = c("item_A","item_B","item_C"), 
                input = c("overallperf_pos","overallperf_neg"),
                group = TRUE)

pld <- cbind(R, temp)

pl <- pltree(R ~ maxNT + maxDT, 
             data = pld)

summary(pl)
#> $`2`
#> Call: PlackettLuce(rankings = y, weights = weights, na.action = NULL, 
#>     start = start)
#> 
#> Coefficients:
#>           Estimate Std. Error z value Pr(>|z|)    
#> CSW18       0.0000         NA      NA       NA    
#> WR544      -3.3246     0.4380  -7.590 3.20e-14 ***
#> PBW343     -0.6595     0.4512  -1.462 0.143852    
#> HP1633     -3.4306     0.4323  -7.936 2.09e-15 ***
#> HW2045     -3.5339     0.4396  -8.039 9.03e-16 ***
#> DBW17      -1.4614     0.4132  -3.537 0.000405 ***
#> HD2985     -2.0511     0.4413  -4.648 3.35e-06 ***
#> DPW621-50  -2.0924     0.4376  -4.782 1.74e-06 ***
#> HD2824     -3.1032     0.4347  -7.138 9.46e-13 ***
#> RAJ4120    -3.0018     0.4331  -6.932 4.16e-12 ***
#> PBW550     -3.2180     0.4269  -7.537 4.79e-14 ***
#> K0307      -3.4931     0.4458  -7.835 4.67e-15 ***
#> HI1563     -3.4131     0.4425  -7.713 1.23e-14 ***
#> PBW502     -3.1382     0.4539  -6.914 4.71e-12 ***
#> HD2932     -2.7048     0.4320  -6.261 3.83e-10 ***
#> K9107       0.2791     0.4794   0.582 0.560486    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual deviance:  766.05 on 855 degrees of freedom
#> AIC:  796.05 
#> Number of iterations: 25
#> 
#> $`3`
#> Call: PlackettLuce(rankings = y, weights = weights, na.action = NULL, 
#>     start = start)
#> 
#> Coefficients:
#>           Estimate Std. Error z value Pr(>|z|)    
#> CSW18       0.0000         NA      NA       NA    
#> WR544      -2.1327     0.4498  -4.741 2.13e-06 ***
#> PBW343      0.2557     0.4366   0.586 0.558045    
#> HP1633     -2.1386     0.4676  -4.574 4.79e-06 ***
#> HW2045     -1.9125     0.4482  -4.267 1.98e-05 ***
#> DBW17      -0.7026     0.4481  -1.568 0.116904    
#> HD2985     -1.1698     0.4286  -2.729 0.006343 ** 
#> DPW621-50  -1.5821     0.4475  -3.535 0.000408 ***
#> HD2824     -2.5380     0.4852  -5.231 1.69e-07 ***
#> RAJ4120    -2.5301     0.4974  -5.087 3.64e-07 ***
#> PBW550     -2.1052     0.4693  -4.486 7.26e-06 ***
#> K0307      -2.3455     0.4467  -5.251 1.51e-07 ***
#> HI1563     -2.3205     0.4502  -5.154 2.54e-07 ***
#> PBW502     -1.9471     0.4245  -4.586 4.51e-06 ***
#> HD2932     -1.5077     0.4469  -3.374 0.000741 ***
#> K9107       1.1110     0.5217   2.129 0.033215 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual deviance:  559.08 on 594 degrees of freedom
#> AIC:  589.08 
#> Number of iterations: 15

plot(pl)

References

1.
van Etten, J., Beza, E., Calderer, L., Van Duijvendijk, K., et al. First experiences with a novel farmer citizen science approach: crowdsourcing participatory variety selection through on-farm triadic comparisons of technologies (tricot). Experimental Agriculture 55, 275–296 (2019).
2.
Turner, H. L., Etten, J. van, Firth, D. & Kosmidis, I. Modelling rankings in R: the PlackettLuce package. Computational Statistics (2020). doi:10.1007/s00180-020-00959-3