-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.json
1 lines (1 loc) · 111 KB
/
search.json
1
[{"path":"/articles/CRTspat.html","id":"summary","dir":"Articles","previous_headings":"","what":"Summary","title":"CRTspat package","text":"CRTspat package intended support design analysis cluster-randomized trials (CRTs) geographical contamination arms. can also used simulation CRTs support development improved methodology. important set applications field trials vector-control interventions malaria. package can facilitate design efficient trials providing algorithms : algorithmic assignment clusters (buffer zones), analysis implications different choices. analysis effects contamination arms simulation trials based geography previously studied field sites trials, observed spatial patterns outcomes, geographical information novel sites. package builds work Multerer et al. (2021a), Multerer et al. (2021b) Anaya-Izquierdo & Alexander(2021). package intended function outcomes proportions, count data, continuous variables. current version (0.1.0.9000) testing developed mainly data proportions. revised ensure gives correct outputs kinds outcome.","code":""},{"path":"/articles/CRTspat.html","id":"anticipated-use-cases","dir":"Articles","previous_headings":"","what":"Anticipated use cases","title":"CRTspat package","text":"Examples provided workflow different use cases, follows: 1. Algorithmic definition clusters 2. Simulation trials geographical contamination 3. Estimation intracluster correlations (ICC) cluster size 4. Estimation optimal cluster size trial pre-determined buffer width 5. Analysis trials (including methods analysing contamination) 6. Thematic mapping geography CRT 7. Power sample size calculations allowing contamination 8, Eggs-fry scramble? Implications excluding buffer zones measurement outcomes 9: Preparation datasets CRTspat 10: Anonymising input locations (required sharing reference datasets)","code":""},{"path":"/articles/CRTspat.html","id":"package-functions","dir":"Articles","previous_headings":"","what":"Package functions","title":"CRTspat package","text":"package functions listed manual.","code":""},{"path":"/articles/CRTspat.html","id":"downloading-and-installing","dir":"Articles","previous_headings":"","what":"Downloading and installing","title":"CRTspat package","text":"CRTspat github can installed using: may need install packages CRTspat depends. particular, functionality depends R-INLA jagsUI however much CRTspat run without packages.","code":"install.packages(\"devtools\") library(devtools) install_github(\"thomasasmith/CRTspat\")"},{"path":"/articles/Usecase2.html","id":"example-with-baseline-data-provided-as-proportions","dir":"Articles","previous_headings":"","what":"Example with baseline data provided as proportions","title":"Use Case 02: Simulation of trials with geographical spillover","text":"Fig 2.1 Map allocations clusters arms Fig 2.2 Plot data distance arm Fig 2.3 Smoothed outcome geostatistical model","code":"library(CRTspat) set.seed(1234) example_locations <- readdata('example_site.csv') example_locations$base_denom <- 1 library(dplyr) example_randomized <- CRTsp(example_locations) %>% aggregateCRT(auxiliaries = c(\"RDT_test_result\", \"base_denom\")) %>% specify_clusters(h = 50, algorithm = 'NN') %>% randomizeCRT(matchedPair = FALSE) summary(example_randomized) ## ===============================CLUSTER RANDOMISED TRIAL =========================== ## ## Summary of coordinates ## ---------------------- ## Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : ## x -3.20 -1.40 -0.30 -0.07 1.26 5.16 ## y -5.08 -2.84 0.19 0.05 2.49 6.16 ## nearestDiscord -3.47 -0.49 0.04 0.14 0.74 3.30 ## ## Total area (within 0.2 km of a location) : 27.6 sq.km ## Total area (convex hull) : 48.2 sq.km ## ## Locations and Clusters ## ---------------------- - ## Coordinate system (x, y) ## Locations: 1181 ## Available clusters (across both arms) 24 ## Per cluster mean number of points 49.2 ## Per cluster s.d. number of points 3.9 ## Cluster randomization: Independently randomized ## No power calculations to report - ## ## Other variables in dataset ## -------------------------- RDT_test_result base_denom plotCRT(example_randomized, map = TRUE, legend.position = c(0.8, 0.8)) example2a <- simulateCRT(example_randomized, effect = 0.8, outcome0 = 0.5, generateBaseline = FALSE, baselineNumerator = \"RDT_test_result\", baselineDenominator = \"base_denom\", ICC_inp = 0.05, spillover_interval = 0.8) summary(example2a) ## ===============================CLUSTER RANDOMISED TRIAL =========================== ## ## Summary of coordinates ## ---------------------- ## Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : ## x -3.20 -1.40 -0.30 -0.07 1.26 5.16 ## y -5.08 -2.84 0.19 0.05 2.49 6.16 ## nearestDiscord -3.47 -0.49 0.04 0.14 0.74 3.30 ## ## Total area (within 0.2 km of a location) : 27.6 sq.km ## Total area (convex hull) : 48.2 sq.km ## ## Locations and Clusters ## ---------------------- - ## Coordinate system (x, y) ## Locations: 1181 ## Available clusters (across both arms) 24 ## Per cluster mean number of points 49.2 ## Per cluster s.d. number of points 3.9 ## Cluster randomization: Independently randomized ## No power calculations to report - ## ## Other variables in dataset ## -------------------------- RDT_test_result base_denom denom propensity num library(Matrix) examplemesh100 <- readdata(\"examplemesh100.rds\") example2aanalysis <- CRTanalysis(trial=example2a, method = 'T') summary(example2aanalysis) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: T ## Link function: logit ## Model formula: arm + (1 | cluster) ## No modelling of spillover ## Estimates: Control: 0.386 (95% CL: 0.301 0.478 ) ## Intervention: 0.191 (95% CL: 0.131 0.269 ) ## Efficacy: 0.506 (95% CL: 0.351 0.784 ) ## Coefficient of variation: 49.3 % (95% CL: 36.5 77.5 ) ## ## P-value (2-sided): 0.001224732 plotCRT(example2aanalysis) example2aINLA <- CRTanalysis(trial=example2a, method = 'INLA', link='logit', cfunc = 'Z', clusterEffects = FALSE, spatialEffects = TRUE, requireMesh = TRUE, inla_mesh = examplemesh100) plotCRT(example2aINLA, map = TRUE, fill = 'prediction', showClusterBoundaries = TRUE, legend.position = c(0.8, 0.8))"},{"path":"/articles/Usecase2.html","id":"example-with-infectiousness-proxy-surface-generated-externally","dir":"Articles","previous_headings":"","what":"Example with infectiousness proxy surface generated externally","title":"Use Case 02: Simulation of trials with geographical spillover","text":"Fig 2.4 Map clusters simulated trial","code":"set.seed(1234) # Simulate a site with 2000 locations new_site <- CRTsp(geoscale = 2, locations=2000, kappa=3, mu=40) # propensity surface generated as an arbitrary linear function of x the co-ordinate new_site$trial$propensity <- 0.5*new_site$trial$x - min(new_site$trial$x)+1 library(dplyr) example2b<- CRTsp(new_site) %>% specify_clusters(h = 40, algorithm = 'NN') %>% randomizeCRT(matchedPair = FALSE) %>% simulateCRT(effect = 0.8, outcome0 = 0.5, generateBaseline = TRUE, ICC_inp = 0.05, spillover_interval = 0.5) ## ## ===================== SIMULATION OF CLUSTER RANDOMISED TRIAL ================= ## *** computed distance to nearest measurements in discordant arm *** ## Estimating the smoothing required to achieve the target ICC of 0.05 ## tol: 0.005 loss = 0.0034482803603185 ## bandwidth: 0.0117436284570214 ICC = 0.108722060252673 loss = 0.0034482803603185 summary(example2b) ## ===============================CLUSTER RANDOMISED TRIAL =========================== ## ## Summary of coordinates ## ---------------------- ## Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : ## x -8.73 -5.16 -1.03 0.00 5.17 11.26 ## y -9.55 -4.42 -0.58 0.00 4.56 10.45 ## nearestDiscord -4.20 -0.93 0.00 0.03 0.96 3.94 ## ## Total area (within 0.2 km of a location) : 181 sq.km ## Total area (convex hull) : 396 sq.km ## ## Locations and Clusters ## ---------------------- - ## Coordinate system (x, y) ## Locations: 2000 ## Available clusters (across both arms) 50 ## Per cluster mean number of points 40 ## Per cluster s.d. number of points 0 ## Cluster randomization: Independently randomized ## No power calculations to report - ## ## Other variables in dataset ## -------------------------- denom propensity num base_denom base_num results2b <- CRTanalysis(example2b, method = 'GEE') ## (Intercept) armintervention ## -0.6322523 -0.4504233 ## No non-linear parameter. No fixed effects of distance - summary(results2b) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: GEE ## Link function: logit ## Model formula: arm ## No modelling of spillover ## Estimates: Control: 0.347 (95% CL: 0.292 0.406 ) ## Intervention: 0.253 (95% CL: 0.216 0.294 ) ## Efficacy: 0.271 (95% CL: 0.0608 0.433 ) ## Coefficient of variation: 50.4 % (95% CL: 40.5 67.3 ) ## Intracluster correlation (ICC) : 0.109 (95% CL: NA NA ) ## plotCRT(example2b, map = TRUE, fill = 'clusters', showClusterLabels = TRUE, maskbuffer = 0.5)"},{"path":"/articles/Usecase2.html","id":"example-with-baseline-generated-from-user-provided-values-of-the-overall-initial-prevalence-and-icc","dir":"Articles","previous_headings":"","what":"Example with baseline generated from user-provided values of the overall initial prevalence and ICC","title":"Use Case 02: Simulation of trials with geographical spillover","text":"","code":"set.seed(1234) # use co-ordinates, cluster and arm assignments, and baseline data from `example_simulated` example2c<- CRTsp(geoscale = 2, locations=2000, kappa=3, mu=40) %>% specify_clusters(h = 40, algorithm = 'NN') %>% randomizeCRT(matchedPair = FALSE) %>% simulateCRT(effect = 0.8, outcome0 = 0.5, generateBaseline = TRUE, baselineNumerator = 'base_num', baselineDenominator = 'base_denom', ICC_inp = 0.08, spillover_interval = 0.2) ## ## ===================== SIMULATION OF CLUSTER RANDOMISED TRIAL ================= ## *** computed distance to nearest measurements in discordant arm *** ## Estimating the smoothing required to achieve the target ICC of 0.08 ## tol: 0.005 loss = 0.00125339394677766 ## bandwidth: 0.0246321272161409 ICC = 0.115403304178814 loss = 0.00125339394677766 results2c <- CRTanalysis(example2c, method = 'GEE') ## (Intercept) armintervention ## -0.6677537 -0.3730238 ## No non-linear parameter. No fixed effects of distance - summary(results2c) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: GEE ## Link function: logit ## Model formula: arm ## No modelling of spillover ## Estimates: Control: 0.339 (95% CL: 0.281 0.402 ) ## Intervention: 0.261 (95% CL: 0.208 0.322 ) ## Efficacy: 0.23 (95% CL: -0.0152 0.419 ) ## Coefficient of variation: 51.9 % (95% CL: 41.6 69.6 ) ## Intracluster correlation (ICC) : 0.115 (95% CL: NA NA ) ##"},{"path":"/articles/Usecase4.html","id":"conclusions","dir":"Articles","previous_headings":"","what":"Conclusions","title":"Use Case 04: Estimation of optimal cluster size for a trial with pre-determined buffer width","text":"example geography selected trial outcome, efficient trial design, conditional buffer width 0.5 km, achieved assigning 30 clusters arm site size analysed, though one third clusters eliminated inclusion buffer zones, . far adequate achieve adequate power. achieve 80% power 8,000 locations needed, larger trial area, 2,400 core (sampled) parts clusters. Fig 4.9 Size trial area required achieve adequate power","code":"ggplot2::ggplot(data = results, aes(x = c_core, y = totallocations_required)) + geom_smooth() + xlab(\"Clusters in core (per arm)\") + ylab(\"Total locations required\") + geom_segment(aes(x = 18, xend = 18, y = 0, yend = 8000), arrow = arrow(length = unit(1, \"cm\")), lwd = 2, color = \"red\")"},{"path":"/articles/Usecase5.html","id":"statistical-methods","dir":"Articles","previous_headings":"","what":"Statistical Methods","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"options can specified using method parameter function call : method = \"T\" summarises outcome level cluster, uses 2-sample t-tests carry statistical significance tests effect, compute confidence intervals effect size. t.test function stats package used. method = \"GEE\" uses Generalised Estimating Equations estimate efficacy model iid random effects clusters. estimate intracluster correlation (ICC) also provided. uses calls gee package. method = \"LME4\" fits linear (continuous data) generalized linear (counts proportions) mixed models iid random effects clusters lme4. method = \"MCMC\" uses Markov chain Monte Carlo simulation package jagsUI, calls r-JAGS. method = \"INLA\" uses approximate Bayesian inference via R-INLA package. provides functionality geostatistical analysis, can used geographical mapping model outputs (illustrated . INLA spatial analysis requires prediction mesh. can generated using CRTspat::new_mesh(). can computationally expensive, recommended compute mesh just dataset. analysis methods can used carry simple comparision outcomes trial arms. offers different additional functionality, limitations (see Table 5.1). limitations specific options offered within CRTanalysis(), embrace full range options packages ‘wrapped’. specified using method argument function. Table 5.1. Available statistical methods analysis proportions, outcome control arm estimated : p̂C=11+exp(−β1)\\hat{p}_{C} = \\frac{1}{1 + exp(-\\beta_1)}, intervention arm p̂=11+exp(−β1−β2)\\hat{p}_{} = \\frac{1}{1 + exp(-\\beta_1-\\beta_2)}, efficacy estimated Ẽs=1−p̃Ip̃C\\tilde{E}_{s} = 1- \\frac{\\tilde{p}_{}}{\\tilde{p}_{C}} β1\\beta_1 intercept term β2\\beta_2 incremental effect associated intervention. summary(\"<analysis>\"\") used view key results trial. display output statistical procedure called, try <analysis>$model_object summary(\"<analysis>$model_object\").","code":"library(CRTspat) example <- readdata(\"exampleCRT.txt\") analysisT <- CRTanalysis(example, method = \"T\") summary(analysisT) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: T ## Link function: logit ## Model formula: arm + (1 | cluster) ## No modelling of spillover ## Estimates: Control: 0.364 (95% CL: 0.286 0.451 ) ## Intervention: 0.21 (95% CL: 0.147 0.292 ) ## Efficacy: 0.423 (95% CL: 0.208 0.727 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## ## P-value (2-sided): 0.006879064 analysisT$model_object ## ## Two Sample t-test ## ## data: lp by arm ## t = 2.9818, df = 22, p-value = 0.006879 ## alternative hypothesis: true difference in means between group control and group intervention is not equal to 0 ## 95 percent confidence interval: ## 0.2332638 1.2989425 ## sample estimates: ## mean in group control mean in group intervention ## -0.5561662 -1.3222694"},{"path":"/articles/Usecase5.html","id":"assessing-model-fit","dir":"Articles","previous_headings":"","what":"Assessing model fit","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"model = \"LME4\" option outputs deviance model Akaike information criterion (AIC), can used select best fitting model. deviance information criterion (DIC) Bayesian information criterion (BIC) perform role Bayesian methods (\"INLA\", \"MCMC\"). comparison results cfunc = \"X\" cfunc = \"Z\" used assess whether intervention effect likely due chance. method = \"T\", cfunc = \"X\" provides significance test intervention effect directly. models spillover (see ) can compared cfunc = \"X\" evaluate whether spillover led important bias.","code":""},{"path":"/articles/Usecase5.html","id":"spillover","dir":"Articles","previous_headings":"","what":"Spillover","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"CRTanalysis() provides options analysing spillover effects either function Euclidean distance function surround measure:","code":""},{"path":"/articles/Usecase5.html","id":"models-that-do-not-consider-spillover","dir":"Articles","previous_headings":"Spillover","what":"Models that do not consider spillover","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"Models consider spillover can fitted using options Z X. included allow conventional analyses (see ), also enable model selection using likelihood ratio tests, Akaike information criterion (AIC), deviance information criterion (DIC) Bayesian information criterion (BIC) .","code":""},{"path":"/articles/Usecase5.html","id":"spillover-as-a-function-of-distance","dir":"Articles","previous_headings":"Spillover","what":"Spillover as a function of distance","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"methods require measure distance boundary trial arms, locations control arm assigned negative values, intervention arm assigned positive values. functional forms relationship specified value cfunc (Table 5.2). Table 5.2. Available spillover functions cfunc options P, L S lead non-linear models spillover scale parameter (S) must estimated. done selecting scale_par using one-dimensional optimisation goodness fit model stats::optimize(). different values cfunc lead fitted curves shown Figure 5.1. light blue shaded part plot corresponds spillover interval cases estimated. Fig 5.1 Fitted curves example dataset different options cfunc piecewise linear spillover function, cfunc = \"S\", linear scale linear predictor. used logistic model, , transformation via inverse link function leads slightly curved plot (Figure 5.1S). rescaled linear function, cfunc = \"R\", provided comparator use distance values distance = \"nearestDiscord\" see (used estimate spillover interval). full set different cfunc options available model options \"LME4\", \"INLA\", \"MCMC\". performance different models yet thoroughly investigated. analyses Multerer et al. (2021b) found model equivalent method = \"MCMC\", cfunc = \"L\" gave estimates efficacy low bias, even simulations considerable spillover.","code":"analysisLME4_Z <- CRTanalysis(example, method = \"LME4\", cfunc = \"Z\") summary(analysisLME4_Z) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Model formula: (1 | cluster) ## No comparison of arms ## Estimates: Control: 0.285 (95% CL: NA ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1387.609 ## AIC : 1391.609 analysisLME4_X <- CRTanalysis(example, method = \"LME4\", cfunc = \"X\") summary(analysisLME4_X) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Model formula: arm + (1 | cluster) ## No modelling of spillover ## Estimates: Control: 0.366 (95% CL: 0.291 0.448 ) ## Intervention: 0.216 (95% CL: 0.162 0.282 ) ## Efficacy: 0.41 (95% CL: 0.164 0.583 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1379.898 ## AIC : 1385.898 analysisLME4_P <- CRTanalysis(example, method = \"LME4\", cfunc = \"P\") summary(analysisLME4_P) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Signed distance to other arm (km) ## Estimated scale parameter: 0.45 ## Model formula: pvar + (1 | cluster) ## Error function model for spillover ## Estimates: Control: 0.417 (95% CL: 0.33 0.508 ) ## Intervention: 0.186 (95% CL: 0.136 0.251 ) ## Efficacy: 0.552 (95% CL: 0.323 0.702 ) ## Spillover interval(km): 4.22 (95% CL: 4.2 4.23 ) ## % locations contaminated: 91.6 (95% CL: 90.6 92 %) ## Total effect : 0.229 (95% CL: 0.113 0.344 ) ## Ipsilateral Spillover : 0.0233 (95% CL: 0.0127 0.0322 ) ## Contralateral Spillover : 0.0415 (95% CL: 0.0191 0.0646 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1374.215 ## AIC : 1382.215 including penalty for the spillover scale parameter analysisLME4_L <- CRTanalysis(example, method = \"LME4\", cfunc = \"L\") summary(analysisLME4_L) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Signed distance to other arm (km) ## Estimated scale parameter: 0.249 ## Model formula: pvar + (1 | cluster) ## Sigmoid (logistic) function for spillover ## Estimates: Control: 0.416 (95% CL: 0.33 0.507 ) ## Intervention: 0.186 (95% CL: 0.135 0.249 ) ## Efficacy: 0.551 (95% CL: 0.328 0.701 ) ## Spillover interval(km): 4.26 (95% CL: 4.24 4.28 ) ## % locations contaminated: 92.7 (95% CL: 92.2 93 %) ## Total effect : 0.229 (95% CL: 0.114 0.342 ) ## Ipsilateral Spillover : 0.0219 (95% CL: 0.012 0.0303 ) ## Contralateral Spillover : 0.0387 (95% CL: 0.018 0.0606 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1374.201 ## AIC : 1382.201 including penalty for the spillover scale parameter analysisLME4_S <- CRTanalysis(example, method = \"LME4\", cfunc = \"S\") summary(analysisLME4_S) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Signed distance to other arm (km) ## Estimated scale parameter: 1.674 ## Model formula: pvar + (1 | cluster) ## Piecewise linear function for spillover ## Estimates: Control: 0.423 (95% CL: 0.334 0.518 ) ## Intervention: 0.185 (95% CL: 0.135 0.247 ) ## Efficacy: 0.561 (95% CL: 0.344 0.71 ) ## Spillover interval(km): 4.1 (95% CL: 4.1 4.11 ) ## % locations contaminated: 86.6 (95% CL: 86.6 87.1 %) ## Total effect : 0.237 (95% CL: 0.122 0.354 ) ## Ipsilateral Spillover : 0.0289 (95% CL: 0.0162 0.0403 ) ## Contralateral Spillover : 0.0521 (95% CL: 0.0253 0.0813 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1374.094 ## AIC : 1382.094 including penalty for the spillover scale parameter analysisLME4_R <- CRTanalysis(example, method = \"LME4\", cfunc = \"R\") summary(analysisLME4_R) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Signed distance to other arm (km) ## No non-linear parameter. 1 ## Model formula: pvar + (1 | cluster) ## Rescaled linear function for spillover ## Estimates: Control: 0.584 (95% CL: 0.383 0.759 ) ## Intervention: 0.116 (95% CL: 0.059 0.216 ) ## Efficacy: 0.8 (95% CL: 0.466 0.919 ) ## Spillover interval(km): 6.64 (95% CL: 6.61 6.65 ) ## % locations contaminated: 99.8 (95% CL: 99.8 99.8 %) ## Total effect : 0.465 (95% CL: 0.181 0.691 ) ## Ipsilateral Spillover : 0.117 (95% CL: 0.0559 0.157 ) ## Contralateral Spillover : 0.236 (95% CL: 0.0831 0.367 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1378.711 ## AIC : 1384.711 p0 <- plotCRT(analysisLME4_Z, map = FALSE) p1 <- plotCRT(analysisLME4_X, map = FALSE) p2 <- plotCRT(analysisLME4_P, map = FALSE) p3 <- plotCRT(analysisLME4_L, map = FALSE) p4 <- plotCRT(analysisLME4_S, map = FALSE) p5 <- plotCRT(analysisLME4_R, map = FALSE) library(cowplot) plot_grid(p0, p1, p2, p3, p4, p5, labels = c('Z', 'X', 'P', 'L', 'S', 'R'), label_size = 10, ncol = 2)"},{"path":"/articles/Usecase5.html","id":"spillover-as-a-function-of-surround","dir":"Articles","previous_headings":"Spillover","what":"Spillover as a function of surround","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"Spillover can also analysed assuming effect size function number intervened locations surroundings location Anaya-Izquierdo & Alexander(2021). Several different surround functions available. specified distance parameter (Table 5.3). Table 5.3. Available surround functions compute_distance() function provided compute quantities, can described, compared, analysed independently CRTanalysis(). Note values surround calculated compute_distance() scaled avoid correlation spatial density points (see documentation) equivalent quantities reported original publications. Users can also devise measures surround distance, add trial data frame specify using distance. CRTanalysis() computes minimum value specified field Fig 5.2 Stacked bar plots different surrounds distance assigned value either hdep, sdep, cfunc = \"R\" used default overall effect size computed comparing fitted values model surround value zero maximum surround data. distance = \"disc\" distance = \"kern\" scale_par assigned value, cfunc = \"R\" also used. cfunc = \"E\" specified escape function fitted scale parameter estimated way scale parameter models (see Table 5.2). Fig 5.3 Fitted curves example dataset different surrounds","code":"examples <- compute_distance(example, distance = \"hdep\") ps1 <- plotCRT(examples, distance = \"hdep\", legend.position = c(0.6, 0.8)) ps2 <- plotCRT(examples, distance = \"sdep\") examples <- compute_distance(examples, distance = \"disc\", scale_par = 0.5) ps3 <- plotCRT(examples, distance = \"disc\") examples <- compute_distance(examples, distance = \"kern\", scale_par = 0.5) ps4 <- plotCRT(examples, distance = \"kern\") plot_grid(ps1, ps2, ps3, ps4, labels = c('hdep', 'sdep', 'disc', 'kern'), label_size = 10, ncol = 2) examples_hdep <- CRTanalysis(examples, method = \"LME4\", distance = \"hdep\", cfunc = 'R') summary(examples_hdep) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Tukey half-depth ## No non-linear parameter. 1 ## Model formula: pvar + (1 | cluster) ## Rescaled linear function for spillover ## Estimates: Control: 0.382 (95% CL: 0.293 0.477 ) ## Intervention: 0.208 (95% CL: 0.151 0.281 ) ## Efficacy: 0.451 (95% CL: 0.168 0.642 ) ## Spillover interval(km): 0.978 (95% CL: 0.976 0.98 ) ## % locations contaminated: 55 (95% CL: 55 55 %) ## Total effect : 0.172 (95% CL: 0.0526 0.292 ) ## Ipsilateral Spillover : 0.0313 (95% CL: 0.0101 0.0511 ) ## Contralateral Spillover : 0.0443 (95% CL: 0.0128 0.0781 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1379.89 ## AIC : 1385.89 ps4 <- plotCRT(examples_hdep,legend.position = c(0.8, 0.8)) examples_sdep <- CRTanalysis(examples, method = \"LME4\", distance = \"sdep\", cfunc = 'R') summary(examples_sdep) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: Simplicial depth ## No non-linear parameter. 1 ## Model formula: pvar + (1 | cluster) ## Rescaled linear function for spillover ## Estimates: Control: 0.394 (95% CL: 0.307 0.488 ) ## Intervention: 0.198 (95% CL: 0.144 0.265 ) ## Efficacy: 0.496 (95% CL: 0.248 0.663 ) ## Spillover interval(km): 0.978 (95% CL: 0.976 0.98 ) ## % locations contaminated: 52.4 (95% CL: 52.2 52.4 %) ## Total effect : 0.195 (95% CL: 0.0808 0.308 ) ## Ipsilateral Spillover : 0.0301 (95% CL: 0.0131 0.046 ) ## Contralateral Spillover : 0.0436 (95% CL: 0.0171 0.0713 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1376.417 ## AIC : 1382.417 ps5 <- plotCRT(examples_sdep) examples_disc <- CRTanalysis(examples, method = \"LME4\", distance = \"disc\", cfunc = 'R', scale_par = 0.15) summary(examples_disc) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: disc of radius 0.15 km ## Precalculated scale parameter: 0.15 ## Model formula: pvar + (1 | cluster) ## Rescaled linear function for spillover ## Estimates: Control: 0.386 (95% CL: 0.312 0.47 ) ## Intervention: 0.2 (95% CL: 0.149 0.262 ) ## Efficacy: 0.481 (95% CL: 0.27 0.635 ) ## Spillover interval(km): 0.978 (95% CL: 0.976 0.98 ) ## % locations contaminated: 8.89 (95% CL: 8.89 8.89 %) ## Total effect : 0.185 (95% CL: 0.0903 0.283 ) ## Ipsilateral Spillover : 0.00456 (95% CL: 0.00237 0.00662 ) ## Contralateral Spillover : 0.00574 (95% CL: 0.00266 0.00905 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1374.274 ## AIC : 1380.274 ps6 <- plotCRT(examples_disc) examples_kern <- CRTanalysis(examples, method = \"LME4\", distance = \"kern\", cfunc = 'R', scale_par = 0.15) summary(examples_kern) ## ## =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= ## Analysis method: LME4 ## Link function: logit ## Measure of distance or surround: kern with kernel s.d. 0.15 km ## Precalculated scale parameter: 0.15 ## Model formula: pvar + (1 | cluster) ## Rescaled linear function for spillover ## Estimates: Control: 0.406 (95% CL: 0.328 0.49 ) ## Intervention: 0.184 (95% CL: 0.136 0.246 ) ## Efficacy: 0.545 (95% CL: 0.341 0.684 ) ## Spillover interval(km): 0.979 (95% CL: 0.977 0.98 ) ## % locations contaminated: 50.8 (95% CL: 50.6 50.9 %) ## Total effect : 0.22 (95% CL: 0.12 0.321 ) ## Ipsilateral Spillover : 0.011 (95% CL: 0.0065 0.0152 ) ## Contralateral Spillover : 0.0135 (95% CL: 0.0069 0.0204 ) ## Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) ## deviance: 1369.677 ## AIC : 1375.677 ps7 <- plotCRT(examples_kern) plot_grid(ps4, ps5, ps6, ps7, labels = c('hdep', 'sdep', 'disc', 'kern'), label_size = 10, ncol = 2)"},{"path":"/articles/Usecase5.html","id":"geostatistical-models-and-mapping-results","dir":"Articles","previous_headings":"","what":"Geostatistical models and mapping results","title":"Use Case 05: Analysis of trials (including methods for analysing spillover)","text":"carry geostatistical analysis method = \"INLA\" prediction mesh needed. default low resolution mesh created (creating high resolution mesh computationally expensive). create 100m INLA mesh <MyTrial>, use: mesh <- new_mesh(trial = <MyTrial> , pixel = 0.1)","code":""},{"path":"/articles/Usecase6.html","id":"conclusions","dir":"Articles","previous_headings":"","what":"Conclusions","title":"Use Case 06: Thematic mapping of the geography of a CRT","text":"example, large proportion data points close boundary arms. analysis (based simulated spillover) suggests effects spillover far beyond 500m buffer. However necessarily mean spillover leads large bias loss power (see Use Case 7).","code":""},{"path":"/articles/Usecase7.html","id":"analysis-by-simulated-true-efficacy","dir":"Articles","previous_headings":"","what":"Analysis by simulated true efficacy","title":"Use Case 07: Power and sample size calculations allowing for spillover","text":"results grouped ranges efficacy, ratio number simulations giving statistically significant results expected number can calculated. Despite spillover, t-test performs similarly expectations across range efficacies investigated (Figure 7.1) Fig 7.1 Performance t-test efficacy purple line: ratio power:nominal power; green line: type II error rate; blue line : bias.","code":"results$effect_cat <- factor(round(results$effect*10)) by_effect <- results[results$effect > 0, ] %>% group_by(effect_cat) %>% summarise_at(c(\"effect\",\"significant_t\", \"nominalpower\", \"bias_t\", \"typeIIerror\"), mean, na.rm = TRUE) by_effect$power_ratio <- with(by_effect, significant_t/nominalpower) library(ggplot2) theme_set(theme_bw(base_size = 14)) ggplot(data = by_effect, aes(x = effect)) + geom_smooth(aes(y = power_ratio), color = \"#b2df8a\",se = FALSE) + geom_smooth(aes(y = typeIIerror), color = \"#D55E00\",se = FALSE) + geom_smooth(aes(y = bias_t), color = \"#0072A7\",se = FALSE) + xlab('Simulated efficacy (%)') + ylab('Performance of t-test')"},{"path":"/articles/Usecase7.html","id":"analysis-by-simulated-spillover-interval","dir":"Articles","previous_headings":"","what":"Analysis by simulated spillover interval","title":"Use Case 07: Power and sample size calculations allowing for spillover","text":"analogous analysis, performance relative efficacy, can carried explore effect simulated spillover interval. relationships simulated spillover interval corresponding proportion locations trial (Figure 7.2). Fig 7.2 Proportion locations simulated spillover interval green line: zone defined gamma_inp; blue line : zone defined sd. spillover results loss power, increased negative bias efficacy estimate, effects rather small (Figure 7.3). potential using CRTanalysis() function model spillover hence correct naive efficacy estimate (t-test) can also explored (see Use Case 5 Multerer et al. (2021b). Fig 7.3 Performance t-test spillover interval purple line: ratio power:nominal power; green line: type II error rate; blue line: bias.","code":"ggplot(data = results, aes(x = spillover_interval)) + geom_smooth(aes(y = contaminate_pop_pr_input), color = \"#b2df8a\",se = FALSE, size = 2) + geom_smooth(aes(y = contaminate_pop_pr_sd), color = \"#0072A7\",se = FALSE, size = 2) + xlab('Simulated spillover interval (km)') + ylab('Proportion of the locations') results$theta_cat <- factor(round(results$spillover_interval*10)) by_theta <- results[results$effect > 0, ] %>% group_by(theta_cat) %>% summarise_at(c(\"spillover_interval\",\"significant_t\", \"nominalpower\", \"bias_t\", \"typeIIerror\"), mean, na.rm = TRUE) by_theta$power_ratio <- with(by_theta, significant_t/nominalpower) ggplot(data = by_theta, aes(x = spillover_interval)) + geom_smooth(aes(y = power_ratio), color = \"#b2df8a\",se = FALSE) + geom_smooth(aes(y = typeIIerror), color = \"#D55E00\",se = FALSE) + geom_smooth(aes(y = bias_t), color = \"#0072A7\",se = FALSE) + xlab('Simulated spillover interval (km)') + ylab('Performance of t-test')"},{"path":"/articles/Usecase8.html","id":"analysis","dir":"Articles","previous_headings":"","what":"Analysis","title":"Use Case 08: Eggs - to fry or scramble?","text":"Figure 8.1. based analysing 1000 simulated datasets (12,000 scenarios ). power calculated proportion significance tests likelihood ratio p < 0.05. fried-egg design suffers little loss power exclusion observations sample size less 750 (suggestion maximum sample size 900 locations presumably effect smoothing results). ‘scrambled’ egg trials lose power reduction number observations (Figure 8.1a), substantive loss power occurs spillover interval 1 km dataset. fried egg designs largely avoid loss power (Figure 8.1b) less powerful average spillover interval less 0.5 km. simulations, lme4 estimates efficacy biased slightly downwards (.e. bias negative sign). absolute bias least locations excluded (Figure 8.1c). less absolute bias fried-egg designs effect small except simulated spillover interval large (Figure 8.1d). difference bias ‘fried’ ‘scrambled’ egg designs modest relation scale overall bias. Fig 8.1 Power bias number locations analysis $\\color{purple}{\\textbf{----}}$ : Randomly sampled locations removed; $\\color{green}{\\textbf{----}}$ : Fried-egg- locations boundary zone removed.","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Thomas Smith. Author, maintainer, copyright holder. Lea Multerer. Contributor. Mariah Silkey. Contributor.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Smith T (2025). CRTspat: Workflow Cluster Randomised Trials Spillover. R package version 1.3.2.","code":"@Manual{, title = {CRTspat: Workflow for Cluster Randomised Trials with Spillover}, author = {Thomas Smith}, year = {2025}, note = {R package version 1.3.2}, }"},{"path":"/index.html","id":"crtspat","dir":"","previous_headings":"","what":"Workflow for Cluster Randomised Trials with Spillover","title":"Workflow for Cluster Randomised Trials with Spillover","text":"CRTspat R-package provide easily accessible R functions design analysis cluster randomized trials (CRTs), geographically structured spillover anticipated geolocations available. includes functions analysing baseline data, defining clusters algorithm, power sample size calculation, analysis trial outcomes. designed function outcomes proportions, count data, continuous variables. package developed CRTs malaria interventions mind, spillover assumed arise result mosquito movement, mosquito dispersal approximated simple diffusion model. preclude use fields research. anticipated use cases described vignettes (articles) package builds work Multerer et al. (2021a), Multerer et al. (2021b) Anaya-Izquierdo & Alexander(2021).","code":""},{"path":"/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Workflow for Cluster Randomised Trials with Spillover","text":"Please note CRTspat project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Workflow for Cluster Randomised Trials with Spillover","text":"CRTspat CRAN github. can installed CRAN using: Markov chain Monte Carlo analysis using CRTspat also requires installation JAGS","code":"install.packages(\"devtools\") library(devtools) install_github(\"thomasasmith/CRTspat\")"},{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 Thomas Smith Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/reference/aggregateCRT.html","id":null,"dir":"Reference","previous_headings":"","what":"Aggregate data across records with duplicated locations — aggregateCRT","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"aggregateCRT aggregates data \"CRTsp\" object trial data frame containing multiple records location, outputs list class \"CRTsp\" containing single values location, coordinates auxiliary variables.","code":""},{"path":"/reference/aggregateCRT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"","code":"aggregateCRT(trial, auxiliaries = NULL)"},{"path":"/reference/aggregateCRT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"trial object class \"CRTsp\" containing locations (x,y) variables summed auxiliaries vector names auxiliary variables summed across location","code":""},{"path":"/reference/aggregateCRT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"list class \"CRTsp\"","code":""},{"path":"/reference/aggregateCRT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"Variables trial dataframe included auxiliaries retained output algorithm \"CRTsp\" object, value corresponding first record location input data frame","code":""},{"path":"/reference/aggregateCRT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Aggregate data across records with duplicated locations — aggregateCRT","text":"","code":"{ trial <- readdata('example_site.csv') trial$base_denom <- 1 aggregated <- aggregateCRT(trial, auxiliaries = c(\"RDT_test_result\",\"base_denom\")) }"},{"path":"/reference/anonymize_site.html","id":null,"dir":"Reference","previous_headings":"","what":"Anonymize locations of a trial site — anonymize_site","title":"Anonymize locations of a trial site — anonymize_site","text":"anonymize_site transforms coordinates remove potential identification information.","code":""},{"path":"/reference/anonymize_site.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Anonymize locations of a trial site — anonymize_site","text":"","code":"anonymize_site(trial, ID = NULL, latvar = \"lat\", longvar = \"long\")"},{"path":"/reference/anonymize_site.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Anonymize locations of a trial site — anonymize_site","text":"trial \"CRTsp\" object trial data frame co-ordinates households ID name column used identifier points latvar name column containing latitudes decimal degrees longvar name column containing longitudes decimal degrees","code":""},{"path":"/reference/anonymize_site.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Anonymize locations of a trial site — anonymize_site","text":"list class \"CRTsp\".","code":""},{"path":"/reference/anonymize_site.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Anonymize locations of a trial site — anonymize_site","text":"coordinates transformed support confidentiality information linked households replacing precise geo-locations transformed co-ordinates preserve distances positions. input may either lat long x,y coordinates. function first searches lat long co-ordinates converts x,y Cartesian coordinates. rotated random angle random origin. returned object transformed co-ordinates re-centred origin. Centroids stored \"CRTsp\" object removed. data unchanged.","code":""},{"path":"/reference/anonymize_site.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Anonymize locations of a trial site — anonymize_site","text":"","code":"#Rotate and reflect test site locations transformedTestlocations <- anonymize_site(trial = readdata(\"exampleCRT.txt\"))"},{"path":"/reference/coef.CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model coefficients — coef.CRTanalysis","title":"Extract model coefficients — coef.CRTanalysis","text":"coef.CRTanalysis method extracting model fitted values","code":""},{"path":"/reference/coef.CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model coefficients — coef.CRTanalysis","text":"","code":"# S3 method for class 'CRTanalysis' coef(object, ...)"},{"path":"/reference/coef.CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model coefficients — coef.CRTanalysis","text":"object CRTanalysis object ... arguments","code":""},{"path":"/reference/coef.CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract model coefficients — coef.CRTanalysis","text":"model coefficients returned statistical model run within CRTanalysis function","code":""},{"path":"/reference/coef.CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract model coefficients — coef.CRTanalysis","text":"","code":"{example <- readdata('exampleCRT.txt') exampleGEE <- CRTanalysis(example, method = \"GEE\") coef(exampleGEE) } #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance - #> (Intercept) armintervention #> -0.5189233 -0.6988229"},{"path":"/reference/compute_distance.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute distance or surround values for a cluster randomized trial — compute_distance","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"compute_distance computes distance surround values cluster randomized trial (CRT)","code":""},{"path":"/reference/compute_distance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"","code":"compute_distance( trial, distance = \"nearestDiscord\", scale_par = NULL, auxiliary = NULL )"},{"path":"/reference/compute_distance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm). distance quantity(s) computed. Options : scale_par scale parameter equal disc radius km distance = \"disc\" standard deviance kernels distance = \"kern\" auxiliary \"CRTsp\" object containing external cluster arm assignments.","code":""},{"path":"/reference/compute_distance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"input \"CRTsp\" object additional column(s) added trial data frame variable name corresponding input value distance.","code":""},{"path":"/reference/compute_distance.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"selected distance measure, function first checks whether variable already present, carries calculations corresponding field absent trial data frame. distance = \"nearestDiscord\" selected computed values Euclidean distances assigned positive sign intervention arm trial, negative sign control arm. distance = \"distanceAssigned\" selected computed values Euclidean distances nearest pixel auxiliary \"CRTsp\" object. distance = \"disc\" specified, disc statistic computed location number locations within specified radius intervention arm (Anaya-Izquierdo & Alexander(2020)). input value scale_par stored design list output \"CRTsp\" object. Recalculation carried input value scale_par differs one input design list. value surround calculated based intervened locations divided value surround calculated basis locations, value returned proportion. distance = \"kern\" specified, Normal curve standard deviation scale_par used simulate diffusion intervention effect Euclidean distance. location trial, contributions intervened locations summed. distance = \"disc\", distance = \"kern\" surround calculated based intervened locations divided value surround calculated basis locations, value returned proportion. either distance = \"hdep\" distance = \"sdep\" specified simplicial depth Tukey half space depth calculated using algorithm Rousseeuw & Ruts(1996). half-depth probability within intervention cloud (di) computed respect locations intervention arm (Anaya-Izquierdo & Alexander(2020)). half-depth within half-depth within control cloud (dc) also computed. CRTspat returns proportion di/(dc + di). auxiliary auxiliary \"CRTsp\" object specified either distanceAssigned nearestDiscord (default) computed respect assignments auxiliary. auxiliary grid design$geometry set 'triangle', 'square' 'hexagon' distance computed edge nearest grid pixel discordant arm (using circular approximation perimeter) rather point location .","code":""},{"path":"/reference/compute_distance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute distance or surround values for a cluster randomized trial — compute_distance","text":"","code":"{ # Calculate the disc with a radius of 0.5 km exampletrial <- compute_distance(trial = readdata('exampleCRT.txt'), distance = 'disc', scale_par = 0.5) }"},{"path":"/reference/compute_mesh.html","id":null,"dir":"Reference","previous_headings":"","what":"Create INLA mesh for spatial analysis — compute_mesh","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"compute_mesh create objects required INLA analysis object class \"CRTsp\".","code":""},{"path":"/reference/compute_mesh.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"","code":"compute_mesh( trial = trial, offset = -0.1, max.edge = 0.25, inla.alpha = 2, maskbuffer = 0.5, pixel = 0.5 )"},{"path":"/reference/compute_mesh.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm) outcome. offset see inla.mesh.2d documentation max.edge see inla.mesh.2d documentation inla.alpha parameter related smoothness (see inla documentation) maskbuffer numeric: width buffer around points (km) pixel numeric: size pixel (km)","code":""},{"path":"/reference/compute_mesh.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"list prediction Data frame containing prediction points covariate values projection matrix observations mesh nodes. Ap projection matrix prediction points mesh nodes. indexs index set SPDE model spde SPDE model pixel pixel size (km)","code":""},{"path":"/reference/compute_mesh.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"compute_mesh carries computationally intensive steps required setting-INLA analysis object class \"CRTsp\", creating prediction mesh projection matrices. mesh can reused different models fitted geography. computational resources required depend largely resolution prediction mesh. prediction mesh thinned include pixels centred distance less maskbuffer nearest point. warning may generated Matrix library loaded.","code":""},{"path":"/reference/compute_mesh.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create INLA mesh for spatial analysis — compute_mesh","text":"","code":"{ # low resolution mesh for test dataset library(Matrix) library(sp) example <- readdata('exampleCRT.txt') exampleMesh=compute_mesh(example, pixel = 0.5) } #> Warning: package 'sp' was built under R version 4.4.2 #> Mesh of 183 pixels of size 0.5 km"},{"path":"/reference/CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Analysis of cluster randomized trial with spillover — CRTanalysis","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"CRTanalysis carries statistical analysis cluster randomized trial (CRT).","code":""},{"path":"/reference/CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"","code":"CRTanalysis( trial, method = \"GEE\", distance = \"nearestDiscord\", scale_par = NULL, cfunc = \"L\", link = \"logit\", numerator = \"num\", denominator = \"denom\", excludeBuffer = FALSE, alpha = 0.05, baselineOnly = FALSE, baselineNumerator = \"base_num\", baselineDenominator = \"base_denom\", personalProtection = FALSE, clusterEffects = TRUE, spatialEffects = FALSE, requireMesh = FALSE, inla_mesh = NULL )"},{"path":"/reference/CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm) outcome data (see details). method statistical method options: distance Measure distance surround options: scale_par numeric: pre-specified value spillover parameter disc radius models fixed (cfunc = \"R\"). cfunc transformation defining spillover function options: link link function options: numerator string: name numerator variable outcome denominator string: name denominator variable outcome data (present) excludeBuffer logical: indicator whether buffer zone (records buffer=TRUE) excluded analysis alpha numeric: confidence level confidence intervals credible intervals baselineOnly logical: indicator whether required analysis effect size baseline baselineNumerator string: name numerator variable baseline data (present) baselineDenominator string: name denominator variable baseline data (present) personalProtection logical: indicator whether model includes local effects spillover clusterEffects logical: indicator whether model includes cluster random effects spatialEffects logical: indicator whether model includes spatial random effects (available method = \"INLA\") requireMesh logical: indicator whether spatial predictions required (available method = \"INLA\") inla_mesh string: name pre-existing INLA input object created compute_mesh()","code":""},{"path":"/reference/CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"list class CRTanalysis containing following results analysis: description : description dataset method : statistical method pt_ests : point estimates int_ests : interval estimates model_object : object returned fitting routine spillover : function values statistics describing estimated spillover","code":""},{"path":"/reference/CRTanalysis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"CRTanalysis wrapper statistical analysis packages: gee, INLA, jagsUI, t.test function package stats. wrapper provide interface full functionality packages. specific typical analyses cluster randomized trials geographical clustering. details provided vignette. key results analyses can extracted using summary() output list. model_object output list usual output statistical analysis routine, can also inspected summary(), analysed using stats::fitted() purposes evaluation model fit etc.. models complementary log-log link function specified link = \"cloglog\". numerator must coded 0 1. Technically binomial denominator 1. value denominator used rate multiplier. \"INLA\" \"MCMC\" methods 'iid' random effects used model extra-Poisson variation. Interval estimates coefficient variation cluster level outcome calculated using method Vangel (1996).","code":""},{"path":"/reference/CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Analysis of cluster randomized trial with spillover — CRTanalysis","text":"","code":"# \\donttest{ example <- readdata('exampleCRT.txt') # Analysis of test dataset by t-test exampleT <- CRTanalysis(example, method = \"T\") #> No non-linear parameter. No fixed effects of distance - summary(exampleT) #> #> =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= #> Analysis method: T #> Link function: logit #> Model formula: arm + (1 | cluster) #> No modelling of spillover #> Estimates: Control: 0.364 (95% CL: 0.286 0.451 ) #> Intervention: 0.21 (95% CL: 0.147 0.292 ) #> Efficacy: 0.423 (95% CL: 0.208 0.727 ) #> Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) #> #> P-value (2-sided): 0.006879064 # Standard GEE analysis of test dataset ignoring spillover exampleGEE <- CRTanalysis(example, method = \"GEE\") #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance - summary(exampleGEE) #> #> =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= #> Analysis method: GEE #> Link function: logit #> Model formula: arm #> No modelling of spillover #> Estimates: Control: 0.373 (95% CL: 0.301 0.452 ) #> Intervention: 0.228 (95% CL: 0.167 0.305 ) #> Efficacy: 0.388 (95% CL: 0.136 0.573 ) #> Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) #> Intracluster correlation (ICC) : 0.1 (95% CL: NA NA ) #> # LME4 analysis with error function spillover function exampleLME4 <- CRTanalysis(example, method = \"LME4\", cfunc = \"P\") #> Estimated scale parameter: 0.45 Signed distance -Signed distance to other arm (km) summary(exampleLME4) #> #> =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= #> Analysis method: LME4 #> Link function: logit #> Measure of distance or surround: Signed distance to other arm (km) #> Estimated scale parameter: 0.45 #> Model formula: pvar + (1 | cluster) #> Error function model for spillover #> Estimates: Control: 0.418 (95% CL: 0.331 0.508 ) #> Intervention: 0.185 (95% CL: 0.135 0.251 ) #> Efficacy: 0.555 (95% CL: 0.329 0.705 ) #> Spillover interval(km): 4.22 (95% CL: 4.2 4.23 ) #> % locations contaminated: 91.6 (95% CL: 90.6 92 %) #> Total effect : 0.232 (95% CL: 0.117 0.345 ) #> Ipsilateral Spillover : 0.0234 (95% CL: 0.013 0.0323 ) #> Contralateral Spillover : 0.0419 (95% CL: 0.0197 0.065 ) #> Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) #> deviance: 1374.215 #> AIC : 1382.215 including penalty for the spillover scale parameter # }"},{"path":"/reference/CRTpower.html","id":null,"dir":"Reference","previous_headings":"","what":"Power and sample size calculations for a cluster randomized trial — CRTpower","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"CRTpower carries power sample size calculations cluster randomized trials.","code":""},{"path":"/reference/CRTpower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"","code":"CRTpower( trial = NULL, locations = NULL, alpha = 0.05, desiredPower = 0.8, effect = NULL, yC = NULL, outcome_type = \"d\", sigma2 = NULL, denominator = 1, N = 1, ICC = NULL, cv_percent = NULL, c = NULL, sd_h = 0, spillover_interval = 0, contaminate_pop_pr = 0, distance_distribution = \"normal\" )"},{"path":"/reference/CRTpower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"trial dataframe 'CRTsp' object: optional list locations locations numeric: total number units available randomization (required trial specified) alpha numeric: confidence level desiredPower numeric: desired power effect numeric: required effect size yC numeric: baseline (control) value outcome outcome_type character: options - 'y': continuous; 'n': count; 'e': event rate; 'p': proportion; 'd': dichotomous. sigma2 numeric: variance outcome (required outcome_type = 'y') denominator numeric: rate multiplier (outcome_type = 'n' outcome_type = 'e') N numeric: mean denominator proportions (outcome_type = 'p') ICC numeric: Intra-cluster correlation cv_percent numeric: Coefficient variation outcome (expressed percentage) c integer: number clusters arm (required trial specified) sd_h numeric: standard deviation number units per cluster (required trial specified) spillover_interval numeric: 95% spillover interval (km) contaminate_pop_pr numeric: Proportion locations within 95% spillover interval. distance_distribution numeric: algorithm computing distribution spillover, options - 'empirical': empirical distribution; 'normal': normal distribution.","code":""},{"path":"/reference/CRTpower.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"list class 'CRTsp' object comprising input data, cluster arm assignments, trial description results power calculations","code":""},{"path":"/reference/CRTpower.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"Power sample size calculations unmatched two-arm trial. counts event rate data formula Hayes & Bennett (1999), Int. J. Epi., 28(2) pp319–326 used. requires input cluster coefficient variation (cv_percent). continuous outcomes proportions formulae Hemming et al, 2011 used. make use intra-cluster correlation outcome (ICC) input. coefficient variation ICC supplied intra-cluster correlation computed coefficient variation using formulae Hayes & Moulton. incompatible values ICC cv_percent supplied value ICC used. calculations consider loss power due loss follow-default adjustment effects spillover. Spillover bias can allowed using diffusion model mosquito movement. location arm assignment information available contaminate_pop_pr used parameterize model using normal approximation distribution distance discordant locations. trial data frame 'CRTsp' object input used determine number locations. input object contains cluster assignments numbers sizes clusters input data used estimate power. spillover_interval > 0 distance_distribution = 'empirical' effects spillover incorporated power calculations based empirical distribution distances nearest discordant location. (distance_distribution equal 'empirical' distribution distances assumed normal. geolocations input power sample size calculations based scalar input parameters. buffer zones specified 'CRTsp' object separate calculations made core area full site. output object class 'CRTsp' containing input trial data frame values : required numbers clusters achieve specified power. design effect based input ICC. Calculations power ignoring bias caused loss follow-etc. Calculations delta, expected spillover bias.","code":""},{"path":"/reference/CRTpower.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Power and sample size calculations for a cluster randomized trial — CRTpower","text":"","code":"{# Power calculations for a binary outcome without input geolocations examplePower1 <- CRTpower(locations = 3000, ICC = 0.10, effect = 0.4, alpha = 0.05, outcome_type = 'd', desiredPower = 0.8, yC=0.35, c = 20, sd_h = 5) summary(examplePower1) # Power calculations for a rate outcome without input geolocations examplePower2 <- CRTpower(locations = 2000, cv_percent = 40, effect = 0.4, denominator = 2.5, alpha = 0.05, outcome_type = 'e', desiredPower = 0.8, yC = 0.35, c = 20, sd_h=5) summary(examplePower2) # Example with input geolocations examplePower3 <- CRTpower(trial = readdata('example_site.csv'), desiredPower = 0.8, effect=0.4, yC=0.35, outcome_type = 'd', ICC = 0.05, c = 20) summary(examplePower3) # Example with input geolocations, randomisation, and spillover example4 <- randomizeCRT(specify_clusters(trial = readdata('example_site.csv'), c = 20)) examplePower4 <- CRTpower(trial = example4, desiredPower = 0.8, effect=0.4, yC=0.35, outcome_type = 'd', ICC = 0.05, contaminate_pop_pr = 0.3) summary(examplePower4) } #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> Locations and Clusters #> ---------------------- - #> Coordinate system No coordinates in dataset #> #> Not aggregated. Total records: 3000. Unique locations: #> Available clusters (across both arms) 40 #> Per cluster mean number of points 75 #> Per cluster s.d. number of points 5 #> #> No locations to randomize - #> #> Specification of Requirements #> ----------------------------- - #> Significance level (2-sided): 0.05 #> Type of Outcome dichotomous #> Expected outcome in control arm: 0.35 #> Required effect size: 0.4 #> Intra-cluster correlation: 0.1 #> #> Power calculations #> ------------------ - #> Design effect: 8.4 #> Calculations ignoring spillover #> Nominal power (%) 84.5 #> Total clusters required (power of 80%): 38 #> Sufficient clusters for required power? Yes #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> Locations and Clusters #> ---------------------- - #> Coordinate system No coordinates in dataset #> #> Not aggregated. Total records: 2000. Unique locations: #> Available clusters (across both arms) 40 #> Per cluster mean number of points 50 #> Per cluster s.d. number of points 5 #> #> No locations to randomize - #> #> Specification of Requirements #> ----------------------------- - #> Significance level (2-sided): 0.05 #> Type of Outcome event rate #> Expected outcome in control arm: 0.35 #> Mean rate multiplier: 2.5 #> Required effect size: 0.4 #> Coefficient of variation (%): 40 #> #> Power calculations #> ------------------ - #> Design effect: 7.8 #> Calculations ignoring spillover #> Nominal power (%) 93.3 #> Total clusters required (power of 80%): 28 #> Sufficient clusters for required power? Yes #> *** Assuming all clusters are the same size *** #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> #> Summary of coordinates #> ---------------------- #> Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : #> x -3.20 -1.31 -0.24 0.00 1.35 5.16 #> y -5.08 -2.84 -0.17 0.00 2.49 6.16 #> #> Total area (within 0.2 km of a location) : 27.6 sq.km #> Total area (convex hull) : 48.2 sq.km #> #> Locations and Clusters #> ---------------------- - #> Coordinate system (x, y) #> #> Not aggregated. Total records: 3172. Unique locations: 1181 #> Available clusters (across both arms) 40 #> Per cluster mean number of points 79.3 #> Per cluster s.d. number of points 0 #> No randomization - #> #> Specification of Requirements #> ----------------------------- - #> Significance level (2-sided): 0.05 #> Type of Outcome dichotomous #> Expected outcome in control arm: 0.35 #> Required effect size: 0.4 #> Intra-cluster correlation: 0.05 #> #> Power calculations #> ------------------ - #> Design effect: 4.9 #> Calculations ignoring spillover #> Nominal power (%) 98 #> Total clusters required (power of 80%): 20 #> Sufficient clusters for required power? Yes #> #> Other variables in dataset #> -------------------------- RDT_test_result #> *** computed distance to nearest measurements in discordant arm *** #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> #> Summary of coordinates #> ---------------------- #> Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : #> x -3.20 -1.31 -0.24 0.00 1.35 5.16 #> y -5.08 -2.84 -0.17 0.00 2.49 6.16 #> nearestDiscord -1.15 -0.33 0.00 -0.00 0.33 1.55 #> #> Total area (within 0.2 km of a location) : 27.6 sq.km #> Total area (convex hull) : 48.2 sq.km #> #> Locations and Clusters #> ---------------------- - #> Coordinate system (x, y) #> #> Not aggregated. Total records: 3172. Unique locations: 1181 #> Available clusters (across both arms) 40 #> Per cluster mean number of points 79.3 #> Per cluster s.d. number of points 4.4 #> Cluster randomization: Independently randomized #> #> Specification of Requirements #> ----------------------------- - #> Significance level (2-sided): 0.05 #> Type of Outcome dichotomous #> Expected outcome in control arm: 0.35 #> Required effect size: 0.4 #> Intra-cluster correlation: 0.05 #> #> Power calculations #> ------------------ - #> Design effect: 4.9 #> Spillover affecting 30% of data, #> normal model gives bias estimate: -0.041 #> Nominal power (%) 93.8 #> Total clusters required (power of 80%): 28 #> Sufficient clusters for required power? Yes #> #> Other variables in dataset #> -------------------------- RDT_test_result"},{"path":"/reference/CRTsp.html","id":null,"dir":"Reference","previous_headings":"","what":"Create or update a ","title":"Create or update a ","text":"CRTsp coerces data frames containing co-ordinates location attributes objects class \"CRTsp\" creates new \"CRTsp\" object simulating set Cartesian co-ordinates use locations simulated trial site","code":""},{"path":"/reference/CRTsp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create or update a ","text":"","code":"CRTsp( x = NULL, design = NULL, geoscale = NULL, locations = NULL, kappa = NULL, mu = NULL, geometry = \"point\" )"},{"path":"/reference/CRTsp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create or update a ","text":"x object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm). Optionally specification buffer zone (logical buffer); variables required subsequent analysis. design list: optional list containing requirements power trial geoscale numeric: standard deviation random displacement settlement cluster center (new objects) locations integer: number locations population (new objects) kappa numeric: intensity Poisson process settlement cluster centers (new objects) mu numeric: mean number points per settlement cluster (new objects) geometry valid values 'point' (default, corresponding point locations), 'triangle', 'square' 'hexagon' corresponding grids constructed pixels regular polygons.","code":""},{"path":"/reference/CRTsp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create or update a ","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/CRTsp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create or update a ","text":"data frame \"CRTsp\" object input output \"CRTsp\" object validated, description geography computed power calculations carried . geoscale, locations, kappa mu specified new trial dataframe constructed corresponding novel simulated human settlement pattern. generated using Thomas algorithm (rThomas) spatstat.random allowing user defined density locations degree spatial clustering. resulting trial data frame comprises set Cartesian coordinates centred origin.","code":""},{"path":"/reference/CRTsp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create or update a ","text":"","code":"{# Generate a simulated area with 10,000 locations example_area = CRTsp(geoscale = 1, locations=10000, kappa=3, mu=40) summary(example_area) } #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> #> Summary of coordinates #> ---------------------- #> Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : #> x -4.85 -2.62 -0.02 0.00 2.52 5.15 #> y -4.88 -2.44 -0.02 0.00 2.37 5.12 #> #> Total area (within 0.2 km of a location) : 106 sq.km #> Total area (convex hull) : 99.7 sq.km #> #> Locations and Clusters #> ---------------------- - #> Coordinate system (x, y) #> Locations: 10000 #> Available clusters (across both arms) Not assigned #> No randomization - #> No power calculations to report -"},{"path":"/reference/CRTspat-package.html","id":null,"dir":"Reference","previous_headings":"","what":"CRTspat: Workflow for Cluster Randomised Trials with Spillover — CRTspat-package","title":"CRTspat: Workflow for Cluster Randomised Trials with Spillover — CRTspat-package","text":"Design, workflow statistical analysis Cluster Randomised Trials (health) interventions may spillover arms (see https://thomasasmith.github.io/index.html).","code":""},{"path":"/reference/CRTspat-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"CRTspat: Workflow for Cluster Randomised Trials with Spillover — CRTspat-package","text":"Maintainer: Thomas Smith [email protected] (ORCID) [copyright holder] contributors: Lea Multerer [contributor] Mariah Silkey [contributor]","code":""},{"path":"/reference/CRTwrite.html","id":null,"dir":"Reference","previous_headings":"","what":"Export of GIS layer from 'CRTsp' — CRTwrite","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"CRTwrite exports simple features object GIS format","code":""},{"path":"/reference/CRTwrite.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"","code":"CRTwrite( object, dsn, feature = \"clusters\", buffer_width, maskbuffer = 0.2, ... )"},{"path":"/reference/CRTwrite.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"object object class 'CRTsp' dsn dataset name (relative path) output objects feature feature exported, options : buffer_width width buffer discordant locations (km) maskbuffer radius buffer drawn around inhabited areas (km) ... arguments passed 'sf::write_sf'","code":""},{"path":"/reference/CRTwrite.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"obj, invisibly","code":""},{"path":"/reference/CRTwrite.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"'sf::write_sf' used format output. function returns TRUE success, FALSE failure, invisibly. input object contains 'centroid' used compute lat long coordinates, assigned \"WGS84\" coordinate reference system. Otherwise objects equirectangular co-ordinates centroid (0,0). feature = 'buffer' buffer width determination described plotCRT(). output vector objects constructed forming Voronoi tessellation polygons around locations combining polygons. polygons outside study area extend outwards external rectangle. 'mask' used mask areas polygons distance > maskbuffer nearest location.","code":""},{"path":"/reference/CRTwrite.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Export of GIS layer from 'CRTsp' — CRTwrite","text":"","code":"# \\donttest{ tmpdir = tempdir() dsn <- paste0(tmpdir,'/arms') CRTwrite(readdata('exampleCRT.txt'), dsn = dsn, feature = 'arms', driver = 'ESRI Shapefile', maskbuffer = 0.2) #> Writing layer `arms' to data source #> `C:\\Users\\smith\\AppData\\Local\\Temp\\Rtmp0MOeCL/arms' using driver `ESRI Shapefile' #> Writing 2 features with 1 fields and geometry type Multi Polygon. # }"},{"path":"/reference/fitted.CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model fitted values — fitted.CRTanalysis","title":"Extract model fitted values — fitted.CRTanalysis","text":"fitted.CRTanalysis method extracting model fitted values","code":""},{"path":"/reference/fitted.CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model fitted values — fitted.CRTanalysis","text":"","code":"# S3 method for class 'CRTanalysis' fitted(object, ...)"},{"path":"/reference/fitted.CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model fitted values — fitted.CRTanalysis","text":"object CRTanalysis object ... arguments","code":""},{"path":"/reference/fitted.CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract model fitted values — fitted.CRTanalysis","text":"fitted values returned statistical model run within CRTanalysis function","code":""},{"path":"/reference/fitted.CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract model fitted values — fitted.CRTanalysis","text":"","code":"{example <- readdata('exampleCRT.txt') exampleGEE <- CRTanalysis(example, method = \"GEE\") fitted_values <- fitted(exampleGEE) } #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance -"},{"path":"/reference/latlong_as_xy.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert lat long co-ordinates to x,y — latlong_as_xy","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"latlong_as_xy converts co-ordinates expressed decimal degrees x,y","code":""},{"path":"/reference/latlong_as_xy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"","code":"latlong_as_xy(trial, latvar = \"lat\", longvar = \"long\")"},{"path":"/reference/latlong_as_xy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"trial trial dataframe list class \"CRTsp\" containing latitudes longitudes decimal degrees latvar name column containing latitudes decimal degrees longvar name column containing longitudes decimal degrees","code":""},{"path":"/reference/latlong_as_xy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/latlong_as_xy.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"output object contains input locations replaced Cartesian coordinates units km, centred (0,0), corresponding using equirectangular projection (valid small areas). data unchanged.","code":""},{"path":"/reference/latlong_as_xy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert lat long co-ordinates to x,y — latlong_as_xy","text":"","code":"examplexy <- latlong_as_xy(readdata(\"example_latlong.csv\"))"},{"path":"/reference/plotCRT.html","id":null,"dir":"Reference","previous_headings":"","what":"Graphical displays of the geography of a CRT — plotCRT","title":"Graphical displays of the geography of a CRT — plotCRT","text":"plotCRT returns graphical displays geography CRT results statistical analyses CRT","code":""},{"path":"/reference/plotCRT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Graphical displays of the geography of a CRT — plotCRT","text":"","code":"plotCRT( object, map = FALSE, distance = \"nearestDiscord\", fill = \"arms\", showLocations = FALSE, showClusterBoundaries = TRUE, showClusterLabels = FALSE, showBuffer = FALSE, cpalette = NULL, buffer_width = NULL, maskbuffer = 0.2, labelsize = 4, legend.position = NULL )"},{"path":"/reference/plotCRT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Graphical displays of the geography of a CRT — plotCRT","text":"object object class 'CRTanalysis' produced CRTanalysis() map logical: indicator whether map required distance measure distance surround options: fill fill layer map options: showLocations logical: determining whether locations shown showClusterBoundaries logical: determining whether cluster boundaries shown showClusterLabels logical: determining whether cluster numbers shown showBuffer logical: whether buffer zone overlayed cpalette colour palette (use different colours clusters must least long number clusters. buffer_width width buffer zone overlayed (km) maskbuffer radius buffer around inhabited areas (km) labelsize size cluster number labels legend.position (using ggplot2::themes syntax)","code":""},{"path":"/reference/plotCRT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Graphical displays of the geography of a CRT — plotCRT","text":"graphics object produced ggplot2 package","code":""},{"path":"/reference/plotCRT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Graphical displays of the geography of a CRT — plotCRT","text":"map = FALSE input trial data frame CRTsp object, containing randomisation arms, stacked bar chart outcome grouped specified distance produced. specified distance yet calculated error returned. map = FALSE input CRTanalysis object plot estimated spillover function generated. fitted spillover function plotted continuous blue line measure surround distance nearest discordant location. Using axes, data summaries plotted ten categories distance boundary. average outcome confidence intervals plotted. analyses logit link function outcome plotted proportion. analyses log cloglog link function data plotted scale Williams mean (mean exp(log(x + 1))) - 1) rescaled median matches fitted curve midpoint. map = TRUE thematic map corresponding value fill generated. fill = 'clusters' leads thematic map showing locations clusters fill = 'arms' leads thematic map showing geography randomization fill = 'distance' leads raster plot distance nearest discordant location. fill = 'prediction' leads raster plot predictions 'INLA' model. showBuffer = TRUE map overlaid grey transparent layer showing areas within defined distance boundary arms. Possibilities : trial randomised showBuffer = FALSE buffer displayed buffer_width takes positive value buffers width displayed irrespective pre-specified spillover limits. input 'CRTanalysis' spillover limits estimated 'LME4' 'INLA' model limits used define displayed buffer. buffer_width specified spillover limits available, pre-specified buffer (e.g. one generated specify_buffer()) displayed. message output indicating possibilities applies.","code":""},{"path":"/reference/plotCRT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Graphical displays of the geography of a CRT — plotCRT","text":"","code":"{example <- readdata('exampleCRT.txt') #Plot of data by distance plotCRT(example) #Map of locations only plotCRT(example, map = TRUE, fill = 'none', showLocations = TRUE, showClusterBoundaries=FALSE, maskbuffer=0.2) #show cluster boundaries and number clusters plotCRT(example, map = TRUE, fill ='none', showClusterBoundaries=TRUE, showClusterLabels=TRUE, maskbuffer=0.2, labelsize = 2) #show clusters in colour plotCRT(example, map = TRUE, fill = 'clusters', showClusterLabels = TRUE, labelsize=2, maskbuffer=0.2) #show arms plotCRT(example, map = TRUE, fill = 'arms', maskbuffer=0.2, legend.position=c(0.8,0.8)) #spillover plot analysis <- CRTanalysis(example) plotCRT(analysis, map = FALSE) } #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance -"},{"path":"/reference/predict.CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Model predictions — predict.CRTanalysis","title":"Model predictions — predict.CRTanalysis","text":"predict.CRTanalysis method extracting model predictions","code":""},{"path":"/reference/predict.CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model predictions — predict.CRTanalysis","text":"","code":"# S3 method for class 'CRTanalysis' predict(object, ...)"},{"path":"/reference/predict.CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model predictions — predict.CRTanalysis","text":"object CRTanalysis object ... arguments","code":""},{"path":"/reference/predict.CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model predictions — predict.CRTanalysis","text":"model predictions returned statistical model run within CRTanalysis function","code":""},{"path":"/reference/predict.CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model predictions — predict.CRTanalysis","text":"","code":"{example <- readdata('exampleCRT.txt') exampleGEE <- CRTanalysis(example, method = \"GEE\") predictions <- predict(exampleGEE) }#' #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance -"},{"path":"/reference/randomizeCRT.html","id":null,"dir":"Reference","previous_headings":"","what":"Randomize a two-armed cluster trial — randomizeCRT","title":"Randomize a two-armed cluster trial — randomizeCRT","text":"randomizeCRT carries randomization clusters augments trial data frame assignments arms","code":""},{"path":"/reference/randomizeCRT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Randomize a two-armed cluster trial — randomizeCRT","text":"","code":"randomizeCRT( trial, matchedPair = FALSE, baselineNumerator = \"base_num\", baselineDenominator = \"base_denom\" )"},{"path":"/reference/randomizeCRT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Randomize a two-armed cluster trial — randomizeCRT","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm). Optionally: specification buffer zone (logical buffer); variables required subsequent analysis. matchedPair logical: indicator whether pair-matching baseline data used randomization baselineNumerator name numerator variable baseline data (required matched-pair randomization) baselineDenominator name denominator variable baseline data (required matched-pair randomization)","code":""},{"path":"/reference/randomizeCRT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Randomize a two-armed cluster trial — randomizeCRT","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/randomizeCRT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Randomize a two-armed cluster trial — randomizeCRT","text":"","code":"# Randomize the clusters in an example trial exampleCRT <- randomizeCRT(trial = readdata('exampleCRT.txt'), matchedPair = TRUE) #> *** No baseline data for matching. Unmatched randomisation *** #> *** computed distance to nearest measurements in discordant arm ***"},{"path":"/reference/readdata.html","id":null,"dir":"Reference","previous_headings":"","what":"Read example dataset — readdata","title":"Read example dataset — readdata","text":"readdata reads file package library example datasets","code":""},{"path":"/reference/readdata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read example dataset — readdata","text":"","code":"readdata(filename)"},{"path":"/reference/readdata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read example dataset — readdata","text":"filename name text file stored within package","code":""},{"path":"/reference/readdata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read example dataset — readdata","text":"R object corresponding text file","code":""},{"path":"/reference/readdata.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Read example dataset — readdata","text":"input file name include extension (either .csv .txt). resulting object data frame extension .csv.","code":""},{"path":"/reference/readdata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read example dataset — readdata","text":"","code":"exampleCRT <- readdata('exampleCRT.txt')"},{"path":"/reference/residuals.CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract model residuals — residuals.CRTanalysis","title":"Extract model residuals — residuals.CRTanalysis","text":"residuals.CRTanalysis method extracting model residuals","code":""},{"path":"/reference/residuals.CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract model residuals — residuals.CRTanalysis","text":"","code":"# S3 method for class 'CRTanalysis' residuals(object, ...)"},{"path":"/reference/residuals.CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract model residuals — residuals.CRTanalysis","text":"object CRTanalysis object ... arguments","code":""},{"path":"/reference/residuals.CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract model residuals — residuals.CRTanalysis","text":"residuals statistical model run within CRTanalysis function","code":""},{"path":"/reference/residuals.CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract model residuals — residuals.CRTanalysis","text":"","code":"{example <- readdata('exampleCRT.txt') exampleGEE <- CRTanalysis(example, method = \"GEE\") residuals <- residuals(exampleGEE) } #> (Intercept) armintervention #> -0.5172565 -0.7004896 #> No non-linear parameter. No fixed effects of distance -"},{"path":"/reference/simulateCRT.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulation of cluster randomized trial with spillover — simulateCRT","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"simulateCRT generates simulated data cluster randomized trial (CRT) geographic spillover arms.","code":""},{"path":"/reference/simulateCRT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"","code":"simulateCRT( trial = NULL, effect = 0, outcome0 = NULL, generateBaseline = TRUE, matchedPair = TRUE, scale = \"proportion\", baselineNumerator = \"base_num\", baselineDenominator = \"base_denom\", denominator = NULL, ICC_inp = NULL, kernels = 200, sigma_m = NULL, spillover_interval = NULL, tol = 0.005 )"},{"path":"/reference/simulateCRT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm). location may also assigned propensity (see details). effect numeric. simulated effect size (defaults 0) outcome0 numeric. anticipated value outcome absence intervention generateBaseline logical. TRUE baseline data propensity simulated matchedPair logical. TRUE function tries carry randomization using pair-matching baseline data (see details) scale measurement scale outcome. Options : 'proportion' (default); 'count'; 'continuous'. baselineNumerator optional name numerator variable pre-existing baseline data baselineDenominator optional name denominator variable pre-existing baseline data denominator optional name denominator variable outcome ICC_inp numeric. Target intra cluster correlation, provided input baseline data simulated kernels number kernels used generate de novo propensity sigma_m numeric. standard deviation normal kernel measuring spatial smoothing leading spillover spillover_interval numeric. input spillover interval tol numeric. tolerance output ICC","code":""},{"path":"/reference/simulateCRT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/simulateCRT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"Synthetic data generated sampling around values variable propensity, numerical vector (taking positive values) length equal number locations. three ways propensity can arise: propensity can provided part input trial object. Baseline numerators denominators (values baselineNumerator baselineDenominator may provided. propensity generated numerator:denominator ratio location input object Otherwise propensity generated using 2D Normal kernel density. OOR::StoSOO used achieve intra-cluster correlation coefficient (ICC) approximates value 'ICC_inp' searching appropriate value kernel bandwidth. num[], synthetic outcome location simulated expectation: $$E(num[]) = outcome0[] * propensity[] * denom[] * (1 - effect*[])/mean(outcome0[] * propensity[])$$ sampling distribution num[] depends value scale follows: scale=’continuous’: Values num sampled Normal distributions means E(num[]) variance determined fitting ICC_inp. scale=’count’: Simulated events allocated locations via multivariate hypergeometric distributions parameterised E(num[]). scale=’proportion’: Simulated events allocated locations via multinomial distributions parameterised E(num[]). denominator may specify vector numeric (non-zero) values input \"CRTsp\" data.frame returned variable denom. acts scale-factor continuous outcomes, rate-multiplier counts, denominator proportions. discrete data values denom must > 0.5 rounded nearest integer calculations num. default, denom generated vector ones, leading simulation dichotomous outcomes scale=’proportion’. baseline numerators denominators provided output vectors base_denom base_num set input values. baseline numerators denominators provided synthetic baseline data generated sampling around propensity way outcome data, effect size set zero. matchedPair TRUE pair-matching baseline data used randomization providing even number clusters. odd number clusters matched pairs generated unmatched randomization output. Either sigma_m spillover_interval must provided. provided value sigma_m overwritten standard deviation implicit value spillover_interval. Spillover simulated arising diffusion-like process. details see Multerer (2021)","code":""},{"path":"/reference/simulateCRT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulation of cluster randomized trial with spillover — simulateCRT","text":"","code":"{smalltrial <- readdata('smalltrial.csv') simulation <- simulateCRT(smalltrial, effect = 0.25, ICC_inp = 0.05, outcome0 = 0.5, matchedPair = FALSE, scale = 'proportion', sigma_m = 0.6, tol = 0.05) summary(simulation) } #> #> ===================== SIMULATION OF CLUSTER RANDOMISED TRIAL ================= #> *** computed distance to nearest measurements in discordant arm *** #> Estimating the smoothing required to achieve the target ICC of 0.05 #> tol: 0.05 loss = 0.0014853339089726 #> bandwidth: 0.0117436284570214 ICC = 0.0885400299555228 loss = 0.0014853339089726 #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> #> Summary of coordinates #> ---------------------- #> Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : #> x -0.70 -0.23 -0.00 0.01 0.30 0.58 #> y -0.77 -0.22 -0.00 0.05 0.24 1.55 #> nearestDiscord -0.34 -0.21 -0.06 -0.00 0.13 1.06 #> #> Total area (within 0.2 km of a location) : 2.06 sq.km #> Total area (convex hull) : 1.32 sq.km #> #> Locations and Clusters #> ---------------------- - #> Coordinate system (x, y) #> Locations: 208 #> Available clusters (across both arms) 18 #> Per cluster mean number of points 11.6 #> Per cluster s.d. number of points 4.9 #> Cluster randomization: Independently randomized #> No power calculations to report - #> #> Other variables in dataset #> -------------------------- denom propensity num base_denom base_num"},{"path":"/reference/specify_buffer.html","id":null,"dir":"Reference","previous_headings":"","what":"Specification of buffer zone in a cluster randomized trial — specify_buffer","title":"Specification of buffer zone in a cluster randomized trial — specify_buffer","text":"specify_buffer specifies buffer zone cluster randomized trial (CRT) flagging locations within defined distance opposite arm.","code":""},{"path":"/reference/specify_buffer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Specification of buffer zone in a cluster randomized trial — specify_buffer","text":"","code":"specify_buffer(trial, buffer_width = 0)"},{"path":"/reference/specify_buffer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Specification of buffer zone in a cluster randomized trial — specify_buffer","text":"trial object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm). buffer_width minimum distance locations opposing arms qualify included core area (km)","code":""},{"path":"/reference/specify_buffer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Specification of buffer zone in a cluster randomized trial — specify_buffer","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/specify_buffer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Specification of buffer zone in a cluster randomized trial — specify_buffer","text":"","code":"#Specify a buffer of 200m exampletrial <- specify_buffer(trial = readdata('exampleCRT.txt'), buffer_width = 0.2)"},{"path":"/reference/specify_clusters.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign locations to clusters in a CRT — specify_clusters","title":"Assign locations to clusters in a CRT — specify_clusters","text":"specify_clusters algorithmically assigns locations clusters grouping geographically","code":""},{"path":"/reference/specify_clusters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign locations to clusters in a CRT — specify_clusters","text":"","code":"specify_clusters( trial = trial, c = NULL, h = NULL, algorithm = \"NN\", reuseTSP = FALSE, auxiliary = NULL )"},{"path":"/reference/specify_clusters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign locations to clusters in a CRT — specify_clusters","text":"trial CRT object data frame containing (x,y) coordinates households c integer: number clusters arm h integer: number locations per cluster algorithm algorithm cluster boundaries, options: reuseTSP logical: indicator whether pre-existing path used TSP algorithm auxiliary \"CRTsp\" object containing external cluster arm assignments.","code":""},{"path":"/reference/specify_clusters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign locations to clusters in a CRT — specify_clusters","text":"list class \"CRTsp\" containing following components:","code":""},{"path":"/reference/specify_clusters.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Assign locations to clusters in a CRT — specify_clusters","text":"Either c h must specified. specified input value c ignored. reuseTSP parameter used allow path reused creating alternative allocations different cluster sizes. auxiliary auxiliary \"CRTsp\" object specified options ignored cluster assignments (arm assignments available) taken auxiliary object. trial data frame augmented column \"nearestPixel\" containing distance boundary nearest grid pixel auxiliary. auxiliary grid design$geometry set 'triangle', 'square' 'hexagon' distance computed edge nearest grid pixel discordant arm (using circular approximation perimeter) rather point location . point within pixel distance given negative sign.","code":""},{"path":"/reference/specify_clusters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign locations to clusters in a CRT — specify_clusters","text":"","code":"#Assign clusters of average size h = 40 to a test set of co-ordinates, using the kmeans algorithm exampletrial <- specify_clusters(trial = readdata('exampleCRT.txt'), h = 40, algorithm = 'kmeans', reuseTSP = FALSE)"},{"path":"/reference/summary.CRTanalysis.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","title":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","text":"summary.CRTanalysis generates summary CRTanalysis including main results","code":""},{"path":"/reference/summary.CRTanalysis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","text":"","code":"# S3 method for class 'CRTanalysis' summary(object, ...)"},{"path":"/reference/summary.CRTanalysis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","text":"object object class \"CRTanalysis\" ... arguments used summary","code":""},{"path":"/reference/summary.CRTanalysis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","text":"return value, writes text console.","code":""},{"path":"/reference/summary.CRTanalysis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary of the results of a statistical analysis of a CRT — summary.CRTanalysis","text":"","code":"{example <- readdata('exampleCRT.txt') exampleT <- CRTanalysis(example, method = \"T\") summary(exampleT) } #> No non-linear parameter. No fixed effects of distance - #> #> =====================CLUSTER RANDOMISED TRIAL ANALYSIS ================= #> Analysis method: T #> Link function: logit #> Model formula: arm + (1 | cluster) #> No modelling of spillover #> Estimates: Control: 0.364 (95% CL: 0.286 0.451 ) #> Intervention: 0.21 (95% CL: 0.147 0.292 ) #> Efficacy: 0.423 (95% CL: 0.208 0.727 ) #> Coefficient of variation: 48.4 % (95% CL: 36 75.9 ) #> #> P-value (2-sided): 0.006879064"},{"path":"/reference/summary.CRTsp.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary description of a ","title":"Summary description of a ","text":"summary.CRTsp provides description \"CRTsp\" object","code":""},{"path":"/reference/summary.CRTsp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary description of a ","text":"","code":"# S3 method for class 'CRTsp' summary(object, maskbuffer = 0.2, ...)"},{"path":"/reference/summary.CRTsp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary description of a ","text":"object object class \"CRTsp\" data frame containing locations (x,y) coordinates, cluster assignments (factor cluster), arm assignments (factor arm) buffer zones (logical buffer), together variables required subsequent analysis. maskbuffer radius area around location include calculation areas ... arguments used summary","code":""},{"path":"/reference/summary.CRTsp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary description of a ","text":"return value, write text console.","code":""},{"path":"/reference/summary.CRTsp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary description of a ","text":"","code":"summary(CRTsp(readdata('exampleCRT.txt'))) #> ===============================CLUSTER RANDOMISED TRIAL =========================== #> #> Summary of coordinates #> ---------------------- #> Min. : 1st Qu.: Median : Mean : 3rd Qu.: Max. : #> x -3.20 -1.40 -0.30 -0.07 1.26 5.16 #> y -5.08 -2.84 0.19 0.05 2.49 6.16 #> nearestDiscord -3.47 -0.49 0.04 0.14 0.74 3.30 #> #> Total area (within 0.2 km of a location) : 27.6 sq.km #> Total area (convex hull) : 48.2 sq.km #> #> Geolocation of centroid (radians): #> latitude: -0.43 longitude: 34.2 #> #> Locations and Clusters #> ---------------------- - #> Coordinate system (x, y) #> Locations: 1181 #> Available clusters (across both arms) 24 #> Per cluster mean number of points 49.2 #> Per cluster s.d. number of points 3.9 #> Cluster randomization: Independently randomized #> No power calculations to report - #> #> Other variables in dataset #> -------------------------- RDT_test_result base_denom propensity denom num"},{"path":"/news/index.html","id":"crtspat-132","dir":"Changelog","previous_headings":"","what":"CRTspat 1.3.2","title":"CRTspat 1.3.2","text":"CRAN release: 2025-01-27","code":""},{"path":"/news/index.html","id":"crtspat-131","dir":"Changelog","previous_headings":"","what":"CRTspat 1.3.1","title":"CRTspat 1.3.1","text":"Replaced dependency ‘geepack’ ‘gee’","code":""},{"path":"/news/index.html","id":"crtspat-130","dir":"Changelog","previous_headings":"","what":"CRTspat 1.3.0","title":"CRTspat 1.3.0","text":"CRAN release: 2024-07-25 Algebra simulation sites following diffusion model spillover. Power sample size calculations allowing diffusion model spillover.","code":""},{"path":"/news/index.html","id":"crtspat-120","dir":"Changelog","previous_headings":"","what":"CRTspat 1.2.0","title":"CRTspat 1.2.0","text":"CRAN release: 2024-02-12 Changed terminology ‘contamination’ ‘spillover’ throughout. Modified algorithm simulation trials reduce edge effects.","code":""},{"path":"/news/index.html","id":"crtspat-110","dir":"Changelog","previous_headings":"","what":"CRTspat 1.1.0","title":"CRTspat 1.1.0","text":"CRAN release: 2023-11-30 Added computation coefficient variation. Added power calculations based coefficients variation.","code":""},{"path":"/news/index.html","id":"crtspat-100","dir":"Changelog","previous_headings":"","what":"CRTspat 1.0.0","title":"CRTspat 1.0.0","text":"CRAN release: 2023-10-16 Initial CRAN submission.","code":""}]