The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Indian Farm Cost Concepts with IndFarmCost

Chiranjit Mazumder, Mrinmoy Ray, and Utkarsh Tiwari

Purpose

IndFarmCost provides a reproducible implementation of the principal Indian farm cost concepts used in farm management and cost-of-cultivation analysis. The package focuses on transparent formulas and uses base R for all core calculations.

Cost-concept structure

The package implements the following identities:

The exact valuation of individual inputs can vary with the survey/manual and reference period. Therefore, the package separates valuation of components from aggregation into cost concepts.

Basic calculation

library(IndFarmCost)

dat <- farm_cost_example()
fc <- farm_costs(dat)
fc[1:4, c("farm_id", "crop", "A1", "A2", "B1", "B2", "C1", "C2", "C3")]
#> Indian farm cost concepts (farmcost)
#>   farm_id  crop    A1    A2    B1    B2    C1    C2    C3
#> 1     F01 Wheat 35070 35070 37370 59370 44570 66570 73227
#> 2     F02 Wheat 36020 39520 38620 63120 44720 69220 76142
#> 3     F03 Wheat 37020 42020 40020 64520 44820 69320 76252
#> 4     F04 Wheat 38270 44770 41770 66270 45270 69770 76747

A2 plus family labour

a2_plus_fl(fc)[1:4]
#> [1] 42270 45620 46820 48270

Group-level analysis

farm_costs_aggregate(fc, by = "crop")
#>     crop    A1    A2    B1     B2    C1     C2       C3
#> 1  Paddy 41460 45585 44510  70385 50260  76135  83748.5
#> 2 Potato 78890 82265 82790 113540 90890 121640 133804.0
#> 3  Wheat 36595 40345 39445  63320 44845  68720  75592.0
farm_costs_aggregate(fc, by = c("state", "farm_size"), method = "median")
#>            state farm_size    A1    A2    B1     B2    C1     C2     C3
#> 1         Punjab     Large 38270 44770 41770  66270 45270  69770  76747
#> 2         Punjab  Marginal 35070 35070 37370  59370 44570  66570  73227
#> 3         Punjab    Medium 37020 42020 40020  64520 44820  69320  76252
#> 4         Punjab     Small 36020 39520 38620  63120 44720  69220  76142
#> 5  Uttar Pradesh     Large 43310 50310 47010  73510 50810  77310  85041
#> 6  Uttar Pradesh  Marginal 39710 39710 42210  66210 49810  73810  81191
#> 7  Uttar Pradesh    Medium 41960 47460 45160  71660 50260  76760  84436
#> 8  Uttar Pradesh     Small 40860 44860 43660  70160 50160  76660  84326
#> 9    West Bengal     Large 82290 88290 86990 117490 92190 122690 134959
#> 10   West Bengal  Marginal 75590 75590 78790 108790 89790 119790 131769
#> 11   West Bengal    Medium 79940 84440 84040 115040 91040 122040 134244
#> 12   West Bengal     Small 77740 80740 81340 112840 90540 122040 134244

Descriptive statistics

summarize_costs(fc)
#>   concept  n     mean       sd   min       q1 median       q3    max cv_percent
#> 1      A1 12 52315.00 19822.70 35070 37957.50  41410  76127.5  82290   37.89104
#> 2      A2 12 56065.00 19939.10 35070 41442.50  46160  76877.5  88290   35.56425
#> 3      B1 12 55581.67 20346.50 37370 41332.50  44410  79427.5  86990   36.60650
#> 4      B2 12 82415.00 23370.50 59370 65787.50  70910 109802.5 117490   28.35710
#> 5      C1 12 61998.33 21470.59 44570 45157.50  50210  89977.5  92190   34.63091
#> 6      C2 12 88831.67 24470.61 66570 69657.50  76710 120352.5 122690   27.54717
#> 7      C3 12 97714.83 26917.67 73227 76623.25  84381 132387.8 134959   27.54717

Returns and benefit-cost ratios

ret <- farm_returns(
  fc,
  main_output = "main_output_q",
  main_price = "main_price_rs_q",
  byproduct_output = "byproduct_output_q",
  byproduct_price = "byproduct_price_rs_q"
)
head(ret[, c("gross_return", "net_C2", "net_C3", "bcr_C2", "bcr_C3")])
#>   gross_return net_C2 net_C3   bcr_C2   bcr_C3
#> 1       127760  61190  54533 1.919183 1.744712
#> 2       133320  64100  57178 1.926033 1.750939
#> 3       138880  69560  62628 2.003462 1.821329
#> 4       144440  74670  67693 2.070231 1.882028
#> 5       136060  62250  54869 1.843382 1.675802
#> 6       141400  64740  57074 1.844508 1.676826

Cost of production and break-even price

byproduct_value <- dat$byproduct_output_q * dat$byproduct_price_rs_q
cost_of_production(fc, "main_output_q", concept = "C2",
                   byproduct_value = byproduct_value)[1:4]
#> [1] 1040.2222 1036.1702  980.4082  935.8824
break_even_price(fc, "main_output_q", concept = "C3",
                 byproduct_value = byproduct_value)[1:4]
#> [1] 1188.156 1183.447 1121.878 1072.686

Cost shares

shares <- cost_shares(fc, "C3")
head(shares)
#>   row component amount denominator share_percent
#> 1   1   A1_base  35070          C3      47.89217
#> 2   2   A1_base  36020          C3      47.30635
#> 3   3   A1_base  37020          C3      48.54955
#> 4   4   A1_base  38270          C3      49.86514
#> 5   5   A1_base  39710          C3      48.90936
#> 6   6   A1_base  40860          C3      48.45481

For every observation, the additive C3 component shares sum to 100 percent, subject only to floating-point rounding.

Sensitivity analysis

cost_sensitivity(dat, "fertilizer", changes = c(-0.20, -0.10, 0, 0.10, 0.20))
#>   change change_percent       A1       A2       B1       B2       C1       C2
#> 1   -0.2            -20 50581.67 54331.67 53848.33 80681.67 60265.00 87098.33
#> 2   -0.1            -10 51448.33 55198.33 54715.00 81548.33 61131.67 87965.00
#> 3    0.0              0 52315.00 56065.00 55581.67 82415.00 61998.33 88831.67
#> 4    0.1             10 53181.67 56931.67 56448.33 83281.67 62865.00 89698.33
#> 5    0.2             20 54048.33 57798.33 57315.00 84148.33 63731.67 90565.00
#>         C3
#> 1 95808.17
#> 2 96761.50
#> 3 97714.83
#> 4 98668.17
#> 5 99621.50

Plotting

plot(fc, row = 1)

Custom A1 definitions

If a particular survey uses a different set of items in A1, pass the required column names explicitly:

my_a1 <- setdiff(standard_a1_components(), "insurance")
fc_custom <- farm_costs(dat, a1_cols = my_a1)
fc_custom[1:3, c("A1", "C2", "C3")]
#> Indian farm cost concepts (farmcost)
#>      A1    C2    C3
#> 1 34620 66120 72732
#> 2 35570 68770 75647
#> 3 36520 68820 75702

Alternatively, a pre-computed A1 column can be supplied through a1_col. This design makes the package adaptable while preserving the algebra linking A1, A2, B1, B2, C1, C2, and C3.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.