Skip to content

Commit

Permalink
Rewritten the references in a proper way. Added two new functions to …
Browse files Browse the repository at this point in the history
…plot a biadjacency matrix.
  • Loading branch information
n3ssuno committed Apr 30, 2018
1 parent 76ed217 commit 14d41cc
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 233 deletions.
16 changes: 8 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Package: RKS
Package: ReKS
Type: Package
Title: Regional Knowledge Space
Version: 0.2.6
Version: 0.2.9
Authors@R: person("Carlo", "Bottai",
email = "[email protected]",
role = c("aut", "cre"))
Maintainer: Carlo Bottai <[email protected]>
Description: By the moment RKS ("rocks") provides four nice functions.
Description: By the moment ReKS (``rex'') provides four functions.
The first computes the entropy of a given array and implement an
algoritm able to decompose it into between and within group entropy
(aka unrelated and related variety). The second calculates the
Coherence Index. The third and the fourth yield the ECI and the
Fitness/Complexity, respectively. In the future how knows?!
URL: https://github.com/n3ssuno/RKS
BugReports: https://github.com/n3ssuno/RKS/issues
(aka Unrelated and Related Variety, respectively). The second calculates
the Coherence Index. The third and the fourth yield the ECI and the
Fitness of a region, respectively.
URL: https://github.com/n3ssuno/ReKS
BugReports: https://github.com/n3ssuno/ReKS/issues
License: GPL-3 + file LICENSE
Encoding: UTF-8
RoxygenNote: 6.0.1
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
exportPattern("^[^\\.]")
# exportPattern("^[[:alpha:]]+")
S3method(plot, rks_biadj_matrix)

importFrom("stats", "complete.cases", "formula", "cor", "quantile")
importFrom("graphics", "plot", "image", "box")
17 changes: 17 additions & 0 deletions R/ReKS.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' ReKS: A package for computating some measure about the knowledge space
#' of a economic region.
#'
#' @section ReKS functions:
#' \itemize{
#' \item{\code{\link{entropy}}}
#' \item{\code{\link{entropy_decomposition}}}
#' \item{\code{\link{entropy_decomposition_panel}}}
#' \item{\code{\link{coherence}}}
#' \item{\code{\link{coherence_panel}}}
#' \item{\code{\link{complexity}}}
#' \item{\code{\link{fitness}}}
#' }
#'
#' @docType package
#' @name ReKS
NULL
38 changes: 25 additions & 13 deletions R/coherence.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,32 @@
#' You can use it both on a panel data set (if you identify also a column with
#' a temporal indication of the observations) or on cross-section data (by
#' leaveing the parameter just said as NULL).
#' See:
#' \itemize{
#' \item{Teece, Rumelt, Dosi and Winter (1994) 'Understanding Corporate
#' Coherence: Theory and Evidence', \emph{Journal of Economic Behavior \&
#' Organization}, 23, 1-30;}
#' \item{Nesta and Saviotti (2005) 'Coherence of the Knowledge Base and the
#'
#' @references
#' Teece, Rumelt, Dosi and Winter (1994) ``Understanding Corporate
#' Coherence: Theory and Evidence'', \emph{Journal of Economic Behavior &
#' Organization}, 23, 1-30;
#'
#' Nesta and Saviotti (2005) ``Coherence of the Knowledge Base and the
#' Firm's Innovative Performance: Evidence from the U.S. Pharmaceutical
#' Industry', \emph{Journal of Industrial Economics}, 53, 123-142;}
#' \item{Nesta and Saviotti (2006) 'Firm Knowledge and Market Value in
#' Biotechnology', \emph{Industrial and Corporate Change}, 15, 625-652;}
#' \item{Quatraro (2010) 'Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions', \emph{Research Policy}, 39,
#' 1289-1302.}
#' Industry'', \emph{Journal of Industrial Economics}, 53, 123-142;
#'
#' Nesta and Saviotti (2006) ``Firm Knowledge and Market Value in
#' Biotechnology'', \emph{Industrial and Corporate Change}, 15, 625-652;
#'
#' Bottazzi and Pirino (2010) ``Measuring Industry Relatedness and
#' Corporate Coherence'', \emph{SSRN Electronic Journal}, 11, 1--24;
#'
#' Quatraro (2010) ``Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions'', \emph{Research Policy}, 39,
#' 1289-1302;
#'
#' Rocchetta and Mina (2017), ``Technological Coherence and the Adaptive
#' Resilience of Regional Economies'', \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.
#'
#' @encoding UTF-8
#'
#' }
#' @param data It is expected to be a dataframe in "long" format.
#' @param geo_dim It is the name of the column of the data.frame that
#' represents its geographical dimension (e.g., the different regions of
Expand All @@ -47,6 +58,7 @@
#' name of the columns above said as strings, otherwise they are assumed to
#' be symbols. Default is FALSE.
#' @return A data.frame with the Coherence Index of each geographical area.
#'
#' @examples
#' RCI <- coherence(data = df, geo_dim = NUTS2,
#' kng_dim = IPC.3dig, kng_nbr = N.patents)
Expand Down
37 changes: 24 additions & 13 deletions R/coherence_panel.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,32 @@
#' You can use it both on a panel data set (if you identify also a column with
#' a temporal indication of the observations) or on cross-section data (by
#' leaveing the parameter just said as NULL).
#' See:
#' \itemize{
#' \item{Teece, Rumelt, Dosi and Winter (1994) 'Understanding Corporate
#' Coherence: Theory and Evidence', \emph{Journal of Economic Behavior \&
#' Organization}, 23, 1-30;}
#' \item{Nesta and Saviotti (2005) 'Coherence of the Knowledge Base and the
#' Firm's Innovative Performance: Evidence from the U.S. Pharmaceutical
#' Industry', \emph{Journal of Industrial Economics}, 53, 123-142;}
#' \item{Nesta and Saviotti (2006) 'Firm Knowledge and Market Value in
#' Biotechnology', \emph{Industrial and Corporate Change}, 15, 625-652;}
#' \item{Quatraro (2010) 'Knowledge Coherence, Variety and Economic Growth:
#'
#' @references
#' Teece, Rumelt, Dosi and Winter (1994) ``Understanding Corporate
#' Coherence: Theory and Evidence'', \emph{Journal of Economic Behavior &
#' Organization}, 23, 1--30;
#'
#' Nesta and Saviotti (2005) ``Coherence of the Knowledge Base and the
#' Firm's Innovative Performance: Evidence from the U.S. Pharmaceutical
#' Industry'', \emph{Journal of Industrial Economics}, 53, 123-142;
#'
#' Nesta and Saviotti (2006) 'Firm Knowledge and Market Value in
#' Biotechnology', \emph{Industrial and Corporate Change}, 15, 625-652;
#'
#' Bottazzi and Pirino (2010) ``Measuring Industry Relatedness and
#' Corporate Coherence'', \emph{SSRN Electronic Journal}, 11, 1--24;
#'
#' Quatraro (2010) 'Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions', \emph{Research Policy}, 39,
#' 1289-1302.}
#' 1289-1302;
#'
#' Rocchetta and Mina (2017), ``Technological Coherence and the Adaptive
#' Resilience of Regional Economies'', \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.
#'
#' @encoding UTF-8
#'
#' }
#' @param data It is expected to be a dataframe in "long" format.
#' @param geo_dim It is the name of the column of the data.frame that
#' represents its geographical dimension (e.g., the different regions of
Expand Down
29 changes: 17 additions & 12 deletions R/complexity.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
#' Regional Knowledge Complexity Index
#'
#' @description
#' The function computes the ``Technological Complexity'' of each geographical
#' area considered, in each given year, in line with the so called \emph{Method
#' of Reflections} (see the references below).
#'
#' @details
#' @references
#' Hidalgo, Klinger, Barabási and Hausmann (2007) ``The Product Space
#' Conditions the Development of Nations'', \emph{Science}, 317, 482--487;
#'
#' See:
#' \itemize{
#' \item{Hidalgo, Klinger, Barab{\'a}si and Hausmann (2007) "The Product Space
#' Conditions the Development of Nations", \emph{Science}, 317, 482--487;}
#' \item{Hidalgo and Hausmann (2009) "The Building Blocks of Economic
#' Complexity", \emph{PNAS}, 106, 10570--10575;}
#' \item{Antonelli, Crespi, Mongeau Ospina and Scellato (2017) "Knowledge
#' Hidalgo and Hausmann (2009) ``The Building Blocks of Economic
#' Complexity'', \emph{PNAS}, 106, 10570--10575;
#'
#' Antonelli, Crespi, Mongeau Ospina and Scellato (2017) ``Knowledge
#' Composition, Jacobs Externalities and Innovation Performance in European
#' Regions", \emph{Regional Studies}, 51, 1708--1720;}
#' \item{Balland and Rigby (2017) "The Geography of Complex Knowledge",
#' \emph{Economic Geography}, 93, 1--23.}
#' }
#' Regions'', \emph{Regional Studies}, 51, 1708--1720;
#'
#' Balland and Rigby (2017) ``The Geography of Complex Knowledge'',
#' \emph{Economic Geography}, 93, 1--23.
#'
#' @encoding UTF-8
#'
#' @param data It is expected to be a dataframe in "long" format.
#' @param geo_dim It is the name of the column of the data.frame that
#' represents its geographical dimension (e.g., the different regions of
Expand Down
22 changes: 13 additions & 9 deletions R/entropy.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@
#' that reports the absolute frequency of each of the possible types/groups of
#' observations of the database.
#' It is also used internally by the entropy decomposition functions.
#' See:
#' \itemize{
#' \item{Shannon (1948) "A Mathematical Theory of Communication", \emph{Bell
#' System Technical Journal}, 27, 379--423;}
#' \item{Theil (1967) \emph{Economics and Information Theory}, North-Holland;}
#' \item{Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;}
#' \item{Frenken (2007) "Entropy statistics and information theory", in
#'
#' @references
#' Shannon (1948) ``A Mathematical Theory of Communication'', \emph{Bell
#' System Technical Journal}, 27, 379--423;
#'
#' Theil (1967) \emph{Economics and Information Theory}, North-Holland;
#'
#' Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;
#'
#' Frenken (2007) ``Entropy Statistics and Information Theory'', in
#' Hanusch and Pyka (Eds.) \emph{Elgar Companion to Neo-Schumpeterian
#' Economics}, Edward Elgar.}
#' }
#' Economics}, Edward Elgar.
#'
#' @encoding UTF-8
#'
#' @param data Numerical vector whos elements are the numerosity of each
#' of the types in which the observations can be categorised (absolute
Expand Down
47 changes: 27 additions & 20 deletions R/entropy_decomposition.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,34 @@
#' decomposed components. The within-groups component is equal to the weighted
#' average of the entropy of each of the groups. So the between-groups component
#' is equal to the residual entropy.
#' See:
#' \itemize{
#' \item{Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;}
#' \item{Zadjenweber (1972) "Une Application de la Th{\'e}orie de l’Information
#' {\`a} l'{\'E}conomie: La Mesure de la Concentration, \emph{Revue d'Economie
#' Politique}, 82, 486–-510;}
#' \item{Attaran (1985) "Industrial Diversity and Economic Performance in U.S.
#' Areas, \emph{The Annals of Regional Science}, 20, 44--54;}
#' \item{Frenken (2007) "Entropy statistics and information theory", in
#'
#' @references
#' Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;
#'
#' Zadjenweber (1972) ``Une Application de la Théorie de l'Information
#' à l'Économie: La Mesure de la Concentration'', \emph{Revue d'Economie
#' Politique}, 82, 486--510;
#'
#' Attaran (1985) ``Industrial Diversity and Economic Performance in U.S.
#' Areas'', \emph{The Annals of Regional Science}, 20, 44--54;
#'
#' Frenken (2007) ``Entropy Statistics and Information Theory'', in
#' Hanusch and Pyka (Eds.) \emph{Elgar Companion to Neo-Schumpeterian
#' Economics}, Edward Elgar.}
#' \item{Frenken, van Oort and Verburg (2007) "Related Variety, Unrelated
#' Variety and Regional Economic Growth", \emph{Regional Studies}, 41,
#' 685--697;}
#' \item{Quatraro (2010) 'Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions', \emph{Research Policy}, 39,
#' 1289--1302;}
#' \item{Rocchetta and Mina (2017), "Technological Coherence and the Adaptive
#' Resilience of Regional Economies", \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.}
#' }
#' Economics}, Edward Elgar;
#'
#' Frenken, van Oort and Verburg (2007) ``Related Variety, Unrelated
#' Variety and Regional Economic Growth'', \emph{Regional Studies}, 41,
#' 685--697;
#'
#' Quatraro (2010) ``Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions'', \emph{Research Policy}, 39,
#' 1289--1302;
#'
#' Rocchetta and Mina (2017), ``Technological Coherence and the Adaptive
#' Resilience of Regional Economies'', \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.
#'
#' @encoding UTF-8
#'
#' @param data Vector of elements.
#' @param groups Vector that describes how the elements in the data can be
Expand Down
47 changes: 27 additions & 20 deletions R/entropy_decomposition_panel.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,34 @@
#' and within-groups information entropy is provided. Internally the function
#' computes and temorarily stores also other values. However they are not
#' provided in the oputput dataframe.
#' See:
#' \itemize{
#' \item{Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;}
#' \item{Zadjenweber (1972) "Une Application de la Th{\'e}orie de l’Information
#' {\`a} l'{\'E}conomie: La Mesure de la Concentration, \emph{Revue d'Economie
#' Politique}, 82, 486–-510;}
#' \item{Attaran (1985) "Industrial Diversity and Economic Performance in U.S.
#' Areas, \emph{The Annals of Regional Science}, 20, 44--54;}
#' \item{Frenken (2007) "Entropy statistics and information theory", in
#'
#' @references
#' Theil (1972) \emph{Statistical Decomposition Analysis}, North-Holland;
#'
#' Zadjenweber (1972) ``Une Application de la Théorie de l'Information
#' à l'Économie: La Mesure de la Concentration'', \emph{Revue d'Economie
#' Politique}, 82, 486--510;
#'
#' Attaran (1985) ``Industrial Diversity and Economic Performance in U.S.
#' Areas'', \emph{The Annals of Regional Science}, 20, 44--54;
#'
#' Frenken (2007) ``Entropy Statistics and Information Theory'', in
#' Hanusch and Pyka (Eds.) \emph{Elgar Companion to Neo-Schumpeterian
#' Economics}, Edward Elgar.}
#' \item{Frenken, van Oort and Verburg (2007) "Related Variety, Unrelated
#' Variety and Regional Economic Growth", \emph{Regional Studies}, 41,
#' 685--697;}
#' \item{Quatraro (2010) 'Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions', \emph{Research Policy}, 39,
#' 1289--1302;}
#' \item{Rocchetta and Mina (2017), "Technological Coherence and the Adaptive
#' Resilience of Regional Economies", \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.}
#' }
#' Economics}, Edward Elgar;
#'
#' Frenken, van Oort and Verburg (2007) ``Related Variety, Unrelated
#' Variety and Regional Economic Growth'', \emph{Regional Studies}, 41,
#' 685--697;
#'
#' Quatraro (2010) ``Knowledge Coherence, Variety and Economic Growth:
#' Manufacturing Evidence from Italian Regions'', \emph{Research Policy}, 39,
#' 1289--1302;
#'
#' Rocchetta and Mina (2017), ``Technological Coherence and the Adaptive
#' Resilience of Regional Economies'', \emph{Papers in Evolutionary Economic
#' Geography}, Utrecht University.
#'
#' @encoding UTF-8
#'
#' @param data It is expected to be a dataframe in "long" format.
#' @param kng_nbr It is expected to be the name of the (numeric) column of the
Expand Down
34 changes: 18 additions & 16 deletions R/fitness.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
#' Regional Knowledge Fitness Index
#'
#' @description
#' The function computes the Fitness (i.e. \emph{competitiveness}) of each given
#' geographical area considered, in each year provided (see the references
#' below for further details).
#'
#' @details
#' @references
#' Tacchella, Cristelli, Caldarelli, Gabrielli and Pietronero (2012)
#' ``A New Metrics for Countries' Fitness and Products' Complexity'',
#' \emph{Scientific Reports}, 2, 1--7;
#'
#' Tacchella, Cristelli, Caldarelli, Gabrielli and Pietronero (2013)
#' ``Economic Complexity: Conceptual Grounding of a New Metrics for Global
#' Competitiveness'', \emph{Journal of Economic Dynamics and Control}, 37,
#' 1683--1691;
#'
#' Cristelli, Gabrielli, Tacchella, Caldarelli and Pietronero (2013)
#' ``Measuring the Intangibles: A Metrics for the Economic Complexity of
#' Countries and Products'', \emph{PLOS ONE}, 8, e70726;
#'
#' @encoding UTF-8
#'
#' See:
#' \itemize{
#' \item{Tacchella, Cristelli, Caldarelli, Gabrielli and Pietronero (2012)
#' "A New Metrics for Countries' Fitness and Products' Complexity",
#' \emph{Scientific Reports}, 2, 1--7;}
#' \item{Tacchella, Cristelli, Caldarelli, Gabrielli and Pietronero (2013)
#' "Economic Complexity: Conceptual Grounding of a New Metrics for Global
#' Competitiveness", \emph{Journal of Economic Dynamics and Control}, 37,
#' 1683--1691;}
#' \item{Cristelli, Gabrielli, Tacchella, Caldarelli and Pietronero (2013)
#' "Measuring the Intangibles: A Metrics for the Economic Complexity of
#' Countries and Products", \emph{PLOS ONE}, 8, e70726;}
#' \item{Balland and Rigby (2017) "The Geography of Complex Knowledge",
#' \emph{Economic Geography}, 93, 1--23.}
#' }
#' @param data It is expected to be a dataframe in "long" format.
#' @param geo_dim It is the name of the column of the data.frame that
#' represents its geographical dimension (e.g., the different regions of
Expand Down
Loading

0 comments on commit 14d41cc

Please sign in to comment.