FLAME_PostgreSQL: PostgreSQL Database Implementation

Description Usage Arguments Value Examples

View source: R/FLAME_PostgreSQL.R

Description

FLAME_PostgreSQL applies the FLAME algorithm based on PostgreSQL. If your computer system does not have PostgreSQL installed, install from here. For setup of PostgreSQL server, please refer to this tutorial. User must connect to PostgreSQL server in R using the command dbConnect(dbDriver('PostgreSQL'), dbname="your_dbname", host='your_localhost', port='your_port', user='your_username', password = 'your_password')

Usage

1
2
3
FLAME_PostgreSQL(db, data, holdout, compute_var = FALSE,
  tradeoff = 0.1, PE_function = NULL, model = NULL,
  ridge_reg = NULL, lasso_reg = NULL)

Arguments

db

name of the database connection

data

input data

holdout

holdout training data

compute_var

variance indicator (optional, default = FALSE)

tradeoff

Match Quality tradeoff parameter (optional, default = 0.1)

PE_function

user defined function to compute predictive error (optional)

model

Linear, Ridge, or Lasso (optional)

ridge_reg

L2 regularization parameter if model = Ridge (optional)

lasso_reg

L1 regularization parameter if model = Lasso (optional)

Value

(1) list of covariates FLAME performs matching at each iteration, (2) Sizes, conditional average treatment effects (CATEs), and variance (if compute_var = TRUE) of matches at each iteration, (3) match quality at each iteration, and (4) the original data with additional column *matched*, indicating the number of covariates each unit is matched on. If a unit is never matched, then *matched* will be 0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data <- data(toy_data)

drv <- dbDriver('PostgreSQL')

db <- dbConnect(drv, user="flame", dbname= "flame",
               host='localhost', port=5432)

FLAME_PostgreSQL(db = db, data = data, holdout = data)

dbDisconnect(db)

chiarui424/FLAME documentation built on Sept. 16, 2019, 8:43 a.m.