The code is based on previous codes of the grf-package (grf_0.10.3.tar.gz) provided by Susan Athey, Julie Tibshirani, and Stefan Wager.
For more information see: https://github.com/grf-labs/grf

Relevant folders are
1) C++ code is in core\src
2) R code is in \r-package\grftsls\R
3) Bindings are in \grftsls\bindings

Installing the package
**********************

The package can be installed by

install.packages(PATH, repos = NULL, type="source")

where PATH is the path where grftsls_0.10.3.tar.gz is saved, for example "C:/folder/r-package/grftsls_0.10.3.tar.gz" on Windows. 

To install the package Rtools (https://cran.r-project.org/bin/windows/Rtools) is requiered. 

If you want to make changes to the source code, you have to rebuild the package by running "build_package.R". 
For more information, we refer to https://grf-labs.github.io/grf/DEVELOPING.html

Usage Example:
**************

library("grftsls")
library("grf")     # Note: The grf package is nessecary for centering.

n <- 2000
p <- 10
k <- 5
X <- matrix(rnorm(n * p, 1, 0.5), n, p)
Z <- matrix(rnorm(n * k, 1, 0.5), n, k)
Q <- matrix(rbinom(n * k, 1, 0.5), n, k)
W <- data.matrix(rowSums(Q * Z))

tau <-  X[, 1] / 2
Y <- data.matrix(rowSums(X[, 1:3]) + tau * W + rowSums(Q) + rnorm(n))

# Build a Forest (incl. tuning and centering). 
tsls.forest <- tsls_forest(X, Y, W, Z, Y.hat = NULL, W.hat = NULL, Z.hat = NULL) # Note: Centering of Y,W,Z is not automatically conducted by default (=0)

# Predict on out-of-bag training samples.
tsls.pred <- predict(tsls.forest, estimate.variance = T)




