CRTsp {CRTspat}  R Documentation 
Create or update a "CRTsp"
object
Description
CRTsp
coerces data frames containing coordinates and location attributes
into objects of class "CRTsp"
or creates a new "CRTsp"
object by simulating a set of Cartesian coordinates for use as the locations in a simulated trial site
Usage
CRTsp(
x = NULL,
design = NULL,
geoscale = NULL,
locations = NULL,
kappa = NULL,
mu = NULL,
geometry = "point"
)
Arguments
x 
an object of class 
design 
list: an optional list containing the requirements for the power of the trial 
geoscale 
numeric: standard deviation of random displacement from each settlement cluster center (for new objects) 
locations 
integer: number of locations in population (for new objects) 
kappa 
numeric: intensity of Poisson process of settlement cluster centers (for new objects) 
mu 
numeric: mean number of points per settlement cluster (for new objects) 
geometry 
with valid values 
Details
If a data frame or "CRTsp"
object is input then the output "CRTsp"
object is validated,
a description of the geography is computed and power calculations are carried out.
If geoscale, locations, kappa
and mu
are specified then a new trial dataframe is constructed
corresponding to a novel simulated human settlement pattern. This is generated using the
Thomas algorithm (rThomas
) in spatstat.random
allowing the user to defined the density of locations and degree of spatial clustering.
The resulting trial data frame comprises a set of Cartesian coordinates centred at the origin.
Value
A list of class "CRTsp"
containing the following components:
design  list:  parameters required for power calculations 
geom_full  list:  summary statistics describing the site 
geom_core  list:  summary statistics describing the core area (when a buffer is specified) 
trial  data frame:  rows correspond to geolocated points, as follows: 
x  numeric vector: xcoordinates of locations  
y  numeric vector: ycoordinates of locations  
cluster  factor: assignments to cluster of each location  
arm  factor: assignments to "control" or "intervention" for each location 

nearestDiscord  numeric vector: Euclidean distance to nearest discordant location (km)  
buffer  logical: indicator of whether the point is within the buffer  
...  other objects included in the input "CRTsp" object or data frame 

Examples
{# Generate a simulated area with 10,000 locations
example_area = CRTsp(geoscale = 1, locations=10000, kappa=3, mu=40)
summary(example_area)
}