# Generalized Score Matching Estimators

## Documentation for package ‘genscore’ version 1.0.2.2

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Code demos. Use demo() to run them.
- Package NEWS.

## Help Pages

AUC | Calculates the AUC of an ROC curve.
avgrocs | Takes the vertical average of ROC curves.
beautify_rule | Replaces consecutive "&"s and "|"s in a string to a single & and |.
binarySearch_bin | Finds the index of the bin a number belongs to using binary search.
calc_crit | Calculates penalized or unpenalized loss in K and eta given arbitrary data
check_endpoints | Checks if two equally sized numeric vectors satisfy the requirements for being left and right endpoints of a domain defined as a union of intervals.
compare_two_results | Compares two lists returned from estimate().
compare_two_sub_results | Compares two lists returned from get_results().
cov_cons | Random generator of inverse covariance matrices.
crbound_mu | The Cram\'er-Rao lower bound (times 'n') for estimating the mean parameter from a univariate truncated normal sample with known variance parameter.
crbound_sigma | The Cram\'er-Rao lower bound (times 'n') for estimating the variance parameter from a univariate truncated normal sample with known mean parameter.
diff_lists | Computes the sum of absolute differences between two lists.
diff_vecs | Computes the sum of absolute differences in the finite non-NA/NULL elements between two vectors.
domain_for_C | Returns a list to be passed to C that represents the domain.
eBIC | eBIC score with or without refitting.
estimate | The main function for the generalized score-matching estimator for graphical models.
find_max_ind | Finds the max index in a vector that does not exceed a target number.
frac_pow | Evaluate x^(a/b) and |x|^(a/b) with integer a and b with extension to conventional operations.
gcd | Finds the greatest (positive) common divisor of two integers.
gen | Random data generator from general 'a'-'b' distributions with general domain types, assuming a and b are rational numbers.
get_crit_nopenalty | Minimized loss for unpenalized restricted asymmetric models.
get_dist | Finds the distance of each element in a matrix x to the its boundary of the domain while fixing the others in the same row.
get_elts | The function wrapper to get the elements necessary for calculations for all settings.
get_elts_ab | The R implementation to get the elements necessary for calculations for general a and b.
get_elts_exp | The R implementation to get the elements necessary for calculations for the exponential square-root setting (a=0.5, b=0.5).
get_elts_gamma | The R implementation to get the elements necessary for calculations for the gamma setting (a=0.5, b=0).
get_elts_gauss | The R implementation to get the elements necessary for calculations for the gaussian setting on R^p.
get_elts_loglog | The R implementation to get the elements necessary for calculations for the log-log setting (a=0, b=0).
get_elts_loglog_simplex | The R implementation to get the elements necessary for calculations for the log-log setting (a=0, b=0) on the p-simplex.
get_elts_trun_gauss | The R implementation to get the elements necessary for calculations for the gaussian setting (a=1, b=1) on domains other than R^p.
get_g0 | Calculates the l2 distance to the boundary of the domain and its gradient for some domains.
get_g0_ada | Adaptively truncates the l2 distance to the boundary of the domain and its gradient for some domains.
get_h_hp | Generator of h and hp (derivative of h) functions.
get_h_hp_adaptive | Generator of adaptive h and hp (derivative of h) functions.
get_h_hp_vector | Generator of h and hp (derivative of h) functions.
get_postfix_rule | Changes a logical expression in infix notation to postfix notation using the shunting-yard algorithm.
get_results | Estimate K and eta using elts from 'get_elts()' given one lambda_K (and lambda_eta if non-profiled non-centered) and applying warm-start with strong screening rules.
get_safe_log_h_hp | Asymptotic log of 'h' and 'hp' functions for large 'x' for modes with an unbounded 'h'.
get_trun | The truncation point for 'h' for 'h' that is truncated (bounded but not naturally bounded).
h_of_dist | Finds the distance of each element in a matrix x to the its boundary of the domain while fixing the others in the same row (dist(x, domain)), and calculates element-wise h(dist(x, domain)) and h\'(dist(x, domain)) (w.r.t. each element in x).
interval_intersection | Finds the intersection between two unions of intervals.
interval_union | Finds the union between two unions of intervals.
in_bound | Returns whether a vector or each row of a matrix falls inside a domain.
lambda_max | Analytic solution for the minimum lambda_K that gives the empty graph.
makecoprime | Makes two integers coprime.
make_domain | Creates a list of elements that defines the domain for a multivariate distribution.
make_folds | Helper function for making fold IDs for cross validation.
mu_sigmasqhat | Estimates the mu and sigma squared parameters from a univariate truncated normal sample.
naiveSearch_bin | Finds the index of the bin a number belongs to using naive search.
parse_ab | Parses an ab setting into rational numbers a and b.
parse_ineq | Parses an ineq expression into a list of elements that represents the ineq.
random_init_polynomial | Randomly generate an initial point in the domain defined by a single polynomial with no negative coefficient.
random_init_simplex | Generates a random point in the (p-1)-simplex.
random_init_uniform | Generates random numbers from a finite union of intervals.
ran_mat | Random generator of matrices with given eigenvalues.
read_exponent | Parses the exponent part into power_numer and power_denom.
read_exponential | Parses the integer coefficient in an exponential term.
read_one_term | Parses the first term of a non-uniform expression.
read_uniform_term | Attempts to parse a single term in x into power_numer and power_denom.
refit | Loss for a refitted (restricted) unpenalized model
rexp_truncated | Generates translated and truncated exponential variables.
rlaplace_truncated | Generates laplace variables truncated to a finite union of intervals.
rlaplace_truncated_centered | Generates centered laplace variables with scale 1.
search_bin | Finds the index of the bin a number belongs to.
s_at | Returns the character at a position of a string.
s_output | Helper function for outputting if verbose.
test_lambda_bounds | Searches for a tight bound for lambda_K that gives the empty or complete graph starting from a given lambda with a given step size
test_lambda_bounds2 | Searches for a tight bound for lambda_K that gives the empty or complete graph starting from a given lambda
tp_fp | Calculates the true and false positive rates given the estimated and true edges.
update_finite_infinity_for_uniform | Maximum between finite_infinity and 10 times the max abs value of finite elements in 'lefts' and 'rights'.
varhat | Asymptotic variance (times 'n') of the estimator for 'mu' or 'sigmasq' for the univariate normal on a general domain assuming the other parameter is known.