Title: | Disaggregate Variable Costs |
---|---|
Description: | These functions were developed within SECFISH project (Strengthening regional cooperation in the area of fisheries data collection-Socio-economic data collection for fisheries, aquaculture and the processing industry at EU level). They are aimed at identifying correlations between costs and transversal variables by metier using individual vessel data and for disaggregating variable costs from fleet segment to metier level. |
Authors: | Isabella Bitetto (COISPA), Loretta Malvarosa (NISEA), Maria Teresa Spedicato (COISPA), Ralf Doering (THUENEN), Joerg Berkenhagen (THUENEN) |
Maintainer: | Isabella Bitetto <[email protected]> |
License: | GPL-2 |
Version: | 0.1.7 |
Built: | 2025-03-03 04:03:29 UTC |
Source: | https://github.com/isabella84/secfish |
individual vessel data. Information about vessel characteristics (e.g. KW, GT, LoA)
Function to validate the results obtained using the Disaggr function. The original costs by fleet segment are compared with the sum of the dsaggregated costs by metier within the same fleet segment.
Cons_check(Costs_FS,Costs_MET,path)
Cons_check(Costs_FS,Costs_MET,path)
Costs_FS |
Data frame containing the variable costs time series by fleet segment. |
Costs_MET |
Data frame containing the variable costs time series by metier within the same fleet segment. |
path |
Path where the results have to be saved. |
Costs_FS |
See example typing Co_FS in the R console. |
Costs_MET |
See example typing Co_MET in the R console. |
path |
Default path=tempdir() |
Isabella Bitetto
Cons_check(Costs_FS,Costs_MET,path=tempdir())
Cons_check(Costs_FS,Costs_MET,path=tempdir())
Function to carry out a constrained regression for a specific fleet segment and a specific type of costs, after setting the metier used by the fleet segment.
Constrained_regression(COSTS, Fleet_segment, metier,type,path)
Constrained_regression(COSTS, Fleet_segment, metier,type,path)
COSTS |
Data frame built applying EA function on individual vessel data and automatically saved as COSTS.csv in the working directory. |
Fleet_segment |
Fleet segment to be investigated. |
metier |
Vector of the metier usedd by the specified fleet segment. |
type |
Type of variable costs on which carry out the constrained regression. |
path |
Path where the results have to be saved. |
COSTS |
data.frame: see format in the package (type CO in the console). |
Fleet_segment |
String defining the fleet segment as reported in the COSTS data frame. |
metier |
String defining the metier as reported in the COSTS data frame. |
type |
String defining the type of variable costs as reported in the COSTS data frame. |
path |
Default path=tempdir() |
Isabella Bitetto
library(optimization) path=tempdir() Constrained_regression(COSTS, "DTS_VL1218", c("OTB_DES_>=40_0_0", "OTB_MDD_>=40_0_0"),"fuelcost",path)
library(optimization) path=tempdir() Constrained_regression(COSTS, "DTS_VL1218", c("OTB_DES_>=40_0_0", "OTB_MDD_>=40_0_0"),"fuelcost",path)
Data frame built applying EA function on individual vessel data and automatically saved as COSTS.csv in the working directory
Data frame of variable costs time series by fleet segment disaggregated by metier
individual vessel data on fuel costs, fuel consumption, maintenance costs and other variable costs
Function to interactively detect outliers on the fGLM fitting of a specific fleet segment.
Detect_outliers(COSTS,Fleet_segment,formula)
Detect_outliers(COSTS,Fleet_segment,formula)
COSTS |
Data frame built applying EA function on individual vessel data and automatically saved as COSTS.csv in the working directory. |
Fleet_segment |
Fleet segment to be investigated. |
formula |
GLM formula for which the outlier is detected. |
COSTS |
See format in the package (type CO in the console). |
Fleet_segment |
A string defining the fleet segment.This string should be the same reported in the COSTS data frame. |
formula |
Example: fuelcost~factor(Met_LOA)+Effort+0 |
Isabella Bitetto
Detect_outliers(COSTS,"DTS_VL1218",fuelcost~factor(Met_LOA)+Effort+0)
Detect_outliers(COSTS,"DTS_VL1218",fuelcost~factor(Met_LOA)+Effort+0)
Function to disaggregate time series of variable costs by from the fleetsegment to the metier level, using the official time series of the costs and the official time series of transversal variables, combined with the results obtained from GLM function applied on individual vessel data.
Disaggr(Costs_or,key_table_or,Eff,path)
Disaggr(Costs_or,key_table_or,Eff,path)
Costs_or |
Data frame containing the variable costs time series by fleet segment. |
key_table_or |
Data frame containing the coefficients of the best fitting GLM, describing the relationship between variable costs structure and transversal variables by metier. |
Eff |
Data frame containing the transversal variables (effort and revenues) by metier. |
path |
Path where the results have to be saved. |
Costs_or |
See example typing Co_or in the R console. |
key_table_or |
See example typing key_tab_or in the R console. Details related to each column: Type of cost: Allowed values: fuel_costs, other_costs, labour_costs, maintenance_costs. Option: 1 additive model, 2 multiplicative model, 3 metier not significant. To fill in the fields Explanatory_variable and Coefficient, the output produced by the GLM.r script has to be considered for that fleet segment for the disaggregation. |
Eff |
See example typing Eff_ in the R console. |
path |
Default path=tempdir() |
Isabella Bitetto
Disaggr(Costs_or,key_table_or,Eff,path=tempdir())
Disaggr(Costs_or,key_table_or,Eff,path=tempdir())
Function to carry out an exploratory analysis on the individual vessel data to derive the correlations between variable costs and transversal variables.
The user has to define the percentage of fishing activity (in hours) to associate a prevalent metier to each vessel (namely by setting the “thr” value) and the minimum number of observations to be required for each metier, within a fleet segment, for carrying out the simple linear correlations analysis. For the metier for which less than “n_obs” observations are available, the simple linear regression is not fitted and the results are not produced.
Moreover, the user can decide to estimate the relationships with 2 options for the activity (Effort): Option 1: hours at sea; Option 2: Days_at_sea x KW. The days at sea are estimated as the sum of the fishing hours divided by 24.
EA(Effort,Landings,Trip,OperID,Operations,Costs_vess, Capacity,thr,n_obs,Eff_option,path)
EA(Effort,Landings,Trip,OperID,Operations,Costs_vess, Capacity,thr,n_obs,Eff_option,path)
Effort |
association trip-total hours at sea |
Landings |
association trip-landing and related revenue |
Trip |
association trip-vessel |
OperID |
association operation-trip |
Operations |
association fishing operation-number of fishing hours-metier |
Costs_vess |
data on fuel costs, fuel consumption, maintenance costs and other variable costs |
Capacity |
information vessel characteristics (KW, GT, LoA, etc…) |
thr |
percentage to fishing activity (hours) associated to the prevalent metier. If 50 is set, only the vessels with a percentage of fishing hours in a specific metier greater or equal to 50 will be retained (this metier will be defined as prevalent metier). |
n_obs |
minimum number of observations for each metier used by the fleet segment for carrying out the simple linear correlations. |
Eff_option |
1: Hours at sea 2: Days at sea X KW |
path |
Path where the results have to be saved. |
Effort |
data.frame: see format in the package (type Eff in the console). |
Landings |
data.frame: see format in the package (type Land in the console) |
Trip |
data.frame: see format in the package (type Tr in the console) |
OperID |
data.frame: see format in the package (type OpID in the console) |
Operations |
data.frame: see format in the package (type Oper in the console) |
Costs_vess |
data.frame: see format in the package (type Cos in the console) |
Capacity |
data.frame: see format in the package (type Cap in the console) |
thr |
a value (even decimal) from 1 to 100 representing a percentage for the definition of the prevalent metier for each vessel. |
n_obs |
number of minimum observations to obtain reliable correlations. A number from 2 to the maximum number of observations by metier in the dataset. |
Eff_option |
1 or 2. |
path |
Default path=tempdir() |
Isabella Bitetto
EA(Effort,Landings,Trip,OperID,Operation,Costs_vess, Capacity,30,30,1,path=tempdir())
EA(Effort,Landings,Trip,OperID,Operation,Costs_vess, Capacity,30,30,1,path=tempdir())
Function to explore GLMs on the individual vessel data to test the significance of metier and transversal variables on the variable costs structure.
The function should be run on COSTS.csv file produced by EA function run previously on individual vessel data. This file should be correctly stored in the working directory. Only the fleet segments with a minimum number of observations are considered. This value can be set by the user as input in the GLM function, defining thr_obs value. It is also possible to define the most significant metier to be used in the GLM through the percentage of cumulative estimated on the number of vessels observed by metier. A buffer of 5 percent on the cumulative percentage is applied by default.
GLM(COSTS,thr_obs,thr_cum,FORMULA_LAB1,FORMULA_LAB2,path)
GLM(COSTS,thr_obs,thr_cum,FORMULA_LAB1,FORMULA_LAB2,path)
COSTS |
Data frame built applying EA function on individual vessel data and automatically saved as COSTS.csv in the working directory. |
thr_obs |
threshold to be used for carry out the modelling to a fleet segment. |
thr_cum |
threshold to be used for selecting the metier to be used in the modelling according to a cumulative metier-number of vessels observed. |
FORMULA_LAB1 |
Option for labour costs modelling (additive model). |
FORMULA_LAB2 |
Option for labour costs modelling (multiplicative model). |
path |
Path where the results have to be saved. |
COSTS |
data.frame: see format in the package (type CO in the console). |
thr_obs |
minimum number of observations needed to run fit the GLM; e.g. 30 means that only the fleet segments with at least 30 vessels observed will be modelled. |
thr_cum |
a decimal number representing a proportion for the selection of the more significant metier: 0.8 means that only the metier representing the 80 percent of the vessels observed in the fleet segment will be considered, to avoid spurious relathionships. |
FORMULA_LAB1 |
Options: crewcost~factor(Met_LOA)+Rev_minus_Tot_var_costs+0 crewcost~factor(Met_LOA)+Sum_revenue+0 crewcost~factor(Met_LOA)+Effort+0 crewcost~factor(Met_LOA)+Rev_minus_fuel+0 |
FORMULA_LAB2 |
Options: crewcost~factor(Met_LOA)*Rev_minus_Tot_var_costs+0 crewcost~factor(Met_LOA)*Sum_revenue+0 crewcost~factor(Met_LOA)*Effort+0 crewcost~factor(Met_LOA)*Rev_minus_fuel+0 |
path |
Default path=tempdir() |
Isabella Bitetto
formula1=crewcost~factor(Met_LOA)+Rev_minus_Tot_var_costs+0 formula2=crewcost~factor(Met_LOA)*Rev_minus_Tot_var_costs+0 GLM(COSTS,30,0.95,formula1,formula2,path=tempdir())
formula1=crewcost~factor(Met_LOA)+Rev_minus_Tot_var_costs+0 formula2=crewcost~factor(Met_LOA)*Rev_minus_Tot_var_costs+0 GLM(COSTS,30,0.95,formula1,formula2,path=tempdir())
Data frame containing the coefficients of the best fitting GLM, describing the relationship between variable costs structure and transversal variables by metier.