Skip to contents

英文原页:regime_shift()

说明

该函数对渔获量最大的top_n个物种的渔获量序列进行突变点分析(平均渔获量的变化,strucchange::breakpoints),并统计每年有多少个物种发生变化。许多物种在同一年发生变化,可能意味着整个生态系统发生了突变(regime shift),也可能源于渔业管理或数据上报方式的改变。

English

This function runs a breakpoint analysis (changes in the mean catch, strucchange::breakpoints) on the catch series of the top_n species with the largest catch, and counts how many species change in each year. Years in which many species change together may point to an ecosystem-wide regime shift, or to changes in fisheries management or reporting.

用法

regime_shift(
  area_data,
  top_n = 20,
  h_value = 0.15,
  plot = TRUE,
  table = TRUE,
  lang = NULL,
  pptx = getOption("faofishingreport.pptx", FALSE),
  plot_show = fao_setting("plot_show"),
  label = NULL
)

参数

area_data
FAO渔获数据:fishing_area_data()$area_data,或load_fao_data()的任意子集(例如一个国家,或几个渔区)。
English FAO catch data: fishing_area_data()$area_data, or any subset of load_fao_data() (e.g. one country, or several fishing areas).
top_n
要分析的物种数,取总渔获量最大的物种。默认为20。
English The number of species with the largest total catch to analyse. Default is 20.
h_value
传给strucchange::breakpoints()的最小分段长度:序列长度的比例(默认为0.15)或年数。
English The minimum segment size passed to strucchange::breakpoints(): a fraction of the series length (default 0.15) or a number of years.
plot
逻辑值。为TRUE(默认)时,图表保存在figures/png/summary/。
English A logical value. If TRUE (default), charts are saved in figures/png/summary/.
table
逻辑值。为TRUE(默认)时,表格保存在tables/。
English A logical value. If TRUE (default), tables are saved in tables/.
lang
图表文字和名称的语言:“en”(英文)、“zh”(中文)或”both”(中英双语)。默认为NULL,即使用fao_settings()设置的语言(未更改时为”en”)。
English The language of the chart text and names: “en” (English), “zh” (Chinese) or “both” (Chinese and English). Default is NULL, which uses the language set with fao_settings() (“en” unless changed).
pptx
逻辑值。为TRUE时,图表还另存为可编辑的PowerPoint文件,保存在figures/pptx/summary/。默认为FALSE,可以用fao_settings(pptx = TRUE)为所有函数统一更改。
English A logical value. If TRUE, charts are also saved as editable PowerPoint files in figures/pptx/summary/. Default is FALSE, which can be changed for all functions with fao_settings(pptx = TRUE).
plot_show
逻辑值。为TRUE时,每张图在保存的同时也画在绘图窗口中(例如RStudio的Plots窗格),便于立即查看。默认为FALSE,可以用fao_settings(plot_show = TRUE)为所有函数统一更改。无论是否显示,图表都会保存为文件(plot = TRUE)。
English A logical value. If TRUE, each chart is also drawn in the plot window (e.g. the Plots pane of RStudio) as it is saved, to look at it at once. Default is FALSE, which can be changed for all functions with fao_settings(plot_show = TRUE). The charts are saved as files (plot = TRUE) either way.
label
输出文件名中使用的名称。默认为数据所属的渔区(或国家)。
English The name used in the output file names. Default is the fishing area (or the country) of the data.

返回值

以不可见方式返回一个列表,包含breakpoints(每个物种一行)和yearly(每年出现突变点的物种数)。

English

Invisibly, a list with breakpoints (one row per species) and yearly (number of species with a breakpoint in each year).

详细说明

突变点的年份是新时段的第一年。序列太短、不满足h_value的物种会被跳过,并给出提示信息。

English

The year of a breakpoint is the first year of the new segment. Species whose series is too short for h_value are skipped with a message.

示例

FAO27 <- fishing_area_data("Atlantic, Northeast", plot = FALSE)
regime_shift(FAO27$area_data, lang = "zh")