# Install the package, if prompted just select 0-cloud
install.packages("StratifiedBalancing")
library(StratifiedBalancing)
# Read data
data=read.csv("simulated bundled data.csv")
fix(data)
# Read the column names and make sure you get the column number correctly
colnames(data)
# Drop first column which is just row numbers and should not be part of analysis
data=data[,-1]
# Select columns for CL, DME, P and H
# Select first 4 columns
# Join with LTH in column 13
# Then look at the data
subset=data[,(1:4)]
subset=cbind(subset,data[,13])sens
fix(subset)
# Balance data
# Use covariates CL, DME, P to see effect of H on LTH
balanced=stratadisc(4,5,subset)
# Check the strata you have created
fix(balanced)
# Sensitivity analysis
revised=sensdisc(4,5,subset)
revised