R/RcppExports.R

Defines functions excess_trans read_link_data num_trans_closures num_in_triangles triangles_biascorr_new_vars

Documented in excess_trans num_in_triangles num_trans_closures read_link_data triangles_biascorr_new_vars

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' compute observed excess transitivity
#'
#' assumes that link observations are ordered canonically a
#'
#' @param df data frame with link data (ordered canonically)
#' @param y_variable string that contains name of column that stores link indicator
#' @param p_variable string that contains name of column that stores link probability
#'
#' @return number of expected transitive triangles
excess_trans <- function(df, y_variable, p_variable) {
    .Call('_netprobitFE_excess_trans', PACKAGE = 'netprobitFE', df, y_variable, p_variable)
}

#' use C++ class LinkVariable to establish link to R data frame
#' 
#' this function is mainly for testing to see if the link is 
#' established correctly 
#' 
#' @param df data frame with link data (ordered canonically)
#' @param i Sender index
#' @param j Receiver index
#' @param var_name name of variabe in data frame 
#' 
#' @return var_name at i, j
#' @export
read_link_data <- function(df, i, j, var_name) {
    .Call('_netprobitFE_read_link_data', PACKAGE = 'netprobitFE', df, i, j, var_name)
}

#' Detect number of transitive relationships closed by this link
#'
#' assumes that link observations are ordered canonically a
#'
#' @param df data frame with link data (ordered canonically)
#' @param y_variable string that contains name of column that stores link indicator
#' @export
#' @return number of supporting transitive triangles for this link
num_trans_closures <- function(df, y_variable) {
    .Call('_netprobitFE_num_trans_closures', PACKAGE = 'netprobitFE', df, y_variable)
}

#' Detect number of triangles that this link is a part of
#'
#' assumes that link observations are ordered canonically a
#'
#' @param df data frame with link data (ordered canonically)
#' @param y_variable string that contains name of column that stores link indicator
#' @export
#' @return number of supporting transitive triangles for this link
num_in_triangles <- function(df, y_variable) {
    .Call('_netprobitFE_num_in_triangles', PACKAGE = 'netprobitFE', df, y_variable)
}

#' add new link variables that are required for bias correction
#' 
#' assumes that link observations are ordered canonically and
#' that data frame contains the variables "p", "H", "partial_p"
#' 
#' @param df data frame with link data (ordered canonically)
#' 
#' @return data frame with new variables
triangles_biascorr_new_vars <- function(df) {
    .Call('_netprobitFE_triangles_biascorr_new_vars', PACKAGE = 'netprobitFE', df)
}
adzemski/netprobitFE documentation built on May 17, 2019, 11:40 a.m.