Skip to content

Commit

Permalink
update gini index with 2024 data pull
Browse files Browse the repository at this point in the history
  • Loading branch information
MandyKarnauskas-NOAA committed May 20, 2024
1 parent 85d265a commit a333ee9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions indicator_processing/CalculateAllIndicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ dir("indicator_processing/fishery_dependent/")

source("indicator_processing/fishery_dependent/INDICATOR_total_landings.R") # calc total landings by group
source("indicator_processing/fishery_dependent/INDICATOR_gearchanges.R") # produces plots but no indicator objects

source("indicator_processing/fishery_dependent/INDICATOR_gini.R") # calculate gini index based on revenues
# not done below

source("indicator_processing/fishery_dependent/INDICATOR_gini.R") #
#
source("indicator_processing/fishery_dependent/INDICATOR_disturbance.R") #
source("indicator_processing/fishery_dependent/INDICATOR_fishery_indicators_PR.R") #
source("indicator_processing/fishery_dependent/INDICATOR_fishery_indicators_STT.R") #
Expand Down
10 changes: 5 additions & 5 deletions indicator_processing/fishery_dependent/INDICATOR_gini.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load("indicator_processing/spec_file.RData")
confpath <- "C:/Users/mandy.karnauskas/Desktop/CONFIDENTIAL/CaribbeanData/MOST_RECENT/"

# define start and end years ---------------------------
styear <- 2000
styear <- 2010
enyear <- 2022

# input data for Puerto Rico ---------------------------
Expand All @@ -44,7 +44,7 @@ table(d$PR_ID_CODE_ED, d$YEAR_LANDED)
# per pound, except those prices for land crabs ("jueyes"), which can fetch up $60 per dozen.

hist(d$PRICE_PER_LB)
table(d$ITIS_COMMON_NAME[which(d$PRICE_PER_LB > 15)])
sort(table(d$ITIS_COMMON_NAME[which(d$PRICE_PER_LB > 15)]))
length(which(d$ITIS_COMMON_NAME != "CRAB,BLUE LAND" & d$PRICE_PER_LB > 15))
d[(which(d$ITIS_COMMON_NAME != "CRAB,BLUE LAND" & d$PRICE_PER_LB > 15)), ]
table(d$ITIS_COMMON_NAME[(which(d$ITIS_COMMON_NAME != "CRAB,BLUE LAND" & d$PRICE_PER_LB > 15))])
Expand Down Expand Up @@ -153,7 +153,7 @@ dim(totland)
# calculate gini index --------------------------------

gini_rev_stt <- apply(totrev, 2, calcGini)
plot(names(gini_rev_stt), gini_rev_stt, type = "b", ylim = c(0.7, 1))
plot(names(gini_rev_stt), gini_rev_stt, type = "b")

gini_land_stt <- apply(totland, 2, calcGini)
plot(names(gini_land_stt), gini_land_stt, col = 2)
Expand Down Expand Up @@ -209,7 +209,7 @@ totrev[is.na(totrev)] <- 0
totrev
rowSums(totrev, na.rm = T)
which(rowSums(totrev, na.rm = T) == 0)
totrev <- totrev[-which(rowSums(totrev, na.rm = T) == 0), ]
#totrev <- totrev[-which(rowSums(totrev, na.rm = T) == 0), ]
dim(totrev)

# sum landings by permit and year ----------------------
Expand Down Expand Up @@ -255,7 +255,7 @@ class(s) <- "indicatordata"
ind <- s

plotIndicatorTimeSeries(ind, coltoplot = 1:3, plotrownum = 3, sublabel = T, sameYscale = T,
widadj = 1.3, hgtadj = 1, trendAnalysis = F)
widadj = 1.3, hgtadj = 1, trendAnalysis = T)

save(ind, file = "indicator_objects/gini.RData")

Expand Down

0 comments on commit a333ee9

Please sign in to comment.