# NOTE: 'directory' has to be substituted by the directory where the functions are stored 

# In S-PLUS the file extension in the source command has to be changed to '.s' 

source("'directory'\\sfunctions\\plotsample.r")
source("'directory'\\sfunctions\\plotnonp.r")
source("'directory'\\sfunctions\\plotsurf.r")
source("'directory'\\sfunctions\\drawmap.r")
source("'directory'\\sfunctions\\readbndfile.r")

plotnonp("res_f_x2_rw.res", psname = "res_f_x2_rw.ps")
plotnonp("res_f_x1_pspline.res", psname = "res_f_x1_pspline.ps")
# NOTE: 'input_filename' must be substituted by the filename of the boundary-file 
# NOTE: choose a 'name' for the map 

readbndfile("'input_filename'", "'name'")
drawmap(map = 'name', outfile = "res_f_district_spatial_pmean.ps", dfile = "res_f_district_spatial.res" ,plotvar = "pmean", regionvar = "district", color = T)
drawmap(map = 'name', outfile = "res_f_district_spatial_pcat95.ps", dfile = "res_f_district_spatial.res" ,plotvar = "pcat95", regionvar = "district", legend = F, pcat = T)
drawmap(map = 'name', outfile = "res_f_district_spatial_pcat80.ps", dfile = "res_f_district_spatial.res",plotvar = "pcat80", regionvar = "district", legend = F, pcat = T)
