Manages the data that forms the basis of the forecasts.
start_year the first year of a time period (default 2011)
end_year the last year of a time period (default 2016)
start_month the first month of a time period (default 1)
end_month the last month of a time period (default 12)
base_data the attribute for holding data extracted from XML (default NA)
time_series_data the attribute for holding the stats::ts
time series type of data after processing base data
(default NA)
pub_cwe_cvss = c("published", "cwe", "cvss_score") a character
vector attribute used in the source code
pub_cwe_count = c("published", "cwe", "count") a character
vector attribute used in the source code
published = "published" a character
attribute used in the source code
new() creates new CWE object
getStartYear() returns private attribute start_year
getEndYear(plus_one = F) returns private attribute end_year
; adds one if plus_one = T
getStartMonth(as_number = F) returns a character
of private attribute start_month
(appends zero to months 1...9); returns private attribute start_month
if as_number = T
getEndMonth(as_number = F, plus_one = F) returns a character
of private attribute end_month
(appends zero to months 1...9); returns private attribute end_month
if as_number = T
; adds one if plus_one = T
getBaseData() returns private attribute base_data
getTimeSeriesData() returns private attribute time_series_data
setStartYear(year) assings the numeric
value of year
to private attribute start_year
setEndYear(year) assings the numeric
value of year
to private attribute end_year
setStartMonth(smonth) assings the numeric
value of smonth
to private attribute start_month
setEndMonth(emonth) assings the numeric
value of emonth
to private attribute end_month
setBaseData(files) calls get_nvd_entries(files) and assings the output to private attribute base_data
; if the argument files
is missing, then assings nvd to base_data
setTimeSeriesData(ts_data) assigns the ts value of ts_data
to private attribute time_series_data
getAnalysisData() returns a data.table where CWEs are between the time limits set by private attributes, where each entry corresponds to one CWE and where each CWE has the date when it was published and its CVSS score (NAs are omitted)
getMostInstances(threshold = 100) returns CWEs which are counted at least threshold
times in a year belonging to the time period set by private attributes
getMostCritical(min_score = 4.0) returns CWEs which have higher mean yearly mean (found by using summed yearly mean CVSS scores and the years count of the time period) severity score than min_score
getChanging(period_threshold = 200) returns CWEs with a total count of at least period_threshold
which mean absolute percentage change (count of the last year vs counts of other years) is higher than the median of the calculated mean absolute percentage change numbers.
getInterestingMonthlyData(threshold = 100, min_score = 4.0, period_threshold = 200, as_monthly_ts = T) returns the union of unique CWEs found by methods getChanging
, getMostCritical
and getMostInstances
. Output is monthly time series with mean monthly CVSS scores when as_monthly_ts = T
, otherwise a character
vector of CWE IDs.
getMonthlyData(desired_cwes) returns monthly time series with mean monthly CVSS scores of all available CWEs when desired_cwes
is missing, otherwise only for those specified in the character
vector desired_cwes