## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = TRUE ) knitr::knit_hooks$set(output = function(x, options) { if (isTRUE(options$fold.output)) { paste0( "
Toggle to see the output ```plaintext ", x, "```
" ) } else { paste0(" ```plaintext ", x, "``` ") } }) ## ----install, eval = FALSE---------------------------------------------------- # # Install smfa from CRAN # install.packages("smfa") # # # Or install the development version from GitHub # # if (!require("devtools")) install.packages("devtools") # # devtools::install_github("SulmanOlieko/smfa") ## ----quickstart-data---------------------------------------------------------- library(smfa) data("ricephil", package = "sfaR") # Create technology groups based on farm area terciles ricephil$group <- cut( ricephil$AREA, breaks = quantile(ricephil$AREA, probs = c(0, 1 / 3, 2 / 3, 1), na.rm = TRUE), labels = c("small", "medium", "large"), include.lowest = TRUE ) table(ricephil$group) ## ----quickstart-fit, fold.output=TRUE----------------------------------------- meta_lp <- smfa( formula = log(PROD) ~ log(AREA) + log(LABOR) + log(NPK), data = ricephil, group = "group", S = 1, # production frontier (S=1) or cost frontier (S=-1) udist = "hnormal", groupType = "sfacross", metaMethod = "lp" ) ## ----quickstart-summary, fold.output=TRUE------------------------------------- summary(meta_lp) ## ----quickstart-eff, fold.output=TRUE----------------------------------------- eff <- efficiencies(meta_lp) head(eff)