useDynLib(mgwrsar, .registration = TRUE)
import(sp)
#import(Rcpp)
import(doParallel)
import(foreach)
import(mapview)
import(knitr)
importFrom("stats","filter","lm","AIC", "family", "gaussian", "glm", "rnorm")
importFrom("caret", "createFolds")
importFrom("stringr", "str_split")
importFrom("SMUT", "eigenMapMatMult")
importFrom("utils", "tail")
importFrom("Matrix","Matrix","Diagonal","sparseMatrix","drop0","nnzero")
importFrom("nabor","knn")
importFrom("methods", "as","is","new")
importFrom("sf", "st_as_sf","st_set_crs","st_coordinates",'st_transform')
importFrom("rlang", "call_modify")
importFrom("mboost", "boost_control","glmboost","Gaussian","Binomial")
importFrom("mgcv", "gam")
importFrom("gridExtra","grid.arrange")
importFrom("dplyr","arrange","desc")
importFrom("grid","textGrob","gpar")
importFrom("ggplot2","ggplot_build","xlim")
importFrom(Rcpp, evalCpp)
importFrom("stats", "D", "as.formula", "coefficients", "contrasts","cooks.distance", "dist", "lm", "lm.fit", "median","model.extract", "model.frame", "model.matrix", "optimize","pf", "predict", "printCoefmat", "quantile", "sd","setNames", "terms", "update", "fitted", "runif", "vcov","na.omit", "reorder")
importFrom("stats", "rchisq")
importFrom("utils", "head")

##wrapper
exportClasses("mgwrsar")
exportMethods("summary")
exportMethods("residuals")
exportMethods("coef")
exportMethods("predict")
export("MGWRSAR")
export("TDS_MGWR")
export("multiscale_gwr")
export("simu_multiscale")
#export("assign_control")
#export("reassign_control")
#export("prep_var")
#export("prep_w")
#export("prep_d")

## method
#export("predict_mgwrsar")
#export("plot_mgwrsar")
export("plot_effect")

## estimation functions
export("Sl_C")
export("PhWY_C")
export("int_prems")
export("INST_C")
export("Proj_C")
export("QRcpp2_C")
export('gwr_beta_pivotal_qrp_cpp')
export('mgwr_beta_pivotal_qrp_mixed_cpp')
export('gwr_beta_univar_cpp')
export('reord_M_R')
export('reord_D')

## prediction
#export("BP_pred_MGWRSAR")
#export("BP_pred_SAR")
#export("Beta_extropolation")

## evaluation
#export("aic_model")
#export("indice_aggreg")

### bootstrap_test
#export("Sidak_cor_MGWR")
#export("Tf")
export("mgwrsar_bootstrap_test")
export("mgwrsar_bootstrap_test_all")

## kernels
#export("bisq")
#export("gauss")
#export("epane")
#export("rectangle")
#export("triangle")
#export("bisq_adapt_sorted")
#export("gauss_adapt_sorted")
#export("epane_adapt_sorted")
#export("rectangle_adapt_sorted")
#export("triangle_adapt_sorted")

## matrix
#export("ApproxiW")
export("normW")
export("summary_Matrix")
export("kernel_matW")

## bandwidth search
export("golden_search_bandwidth")
export("golden_search_2d_bandwidth")
export('search_bandwidths')
#export("fb")
#####export("SSR")

## target points
export("find_TP")
#export("tp")
#export("quadtree")
#export("quadTP")
#export("cell")
#export("insidecell")
#export("equidistantGrid")

## other
export("make_unique_by_structure")
importFrom("stats", "residuals")
importFrom("methods", "slot")
importFrom("stats", "lm.influence","ave")
importFrom("utils", "data")
importFrom("lifecycle", "deprecate_warn")
importFrom("stats", "mad")

importFrom(plotly,add_trace)
importFrom(plotly,config)
importFrom(plotly,layout)
importFrom(plotly,plot_ly)
importFrom(sf,st_as_sf)
importFrom(sf,st_coordinates)
importFrom(sf,st_crs)
importFrom(sf,"st_crs<-")
importFrom(sf,st_transform)
importFrom(methods,.hasSlot)
importFrom(methods,slotNames)
importFrom(stats,lm.wfit)
importFrom(utils,modifyList)
importFrom(utils,setTxtProgressBar)
importFrom(utils,txtProgressBar)
importFrom(magrittr,"%>%")
