## 4.1 What is sampling and spatial sampling?

Sampling is the process of selecting a part of a population to estimate the characteristics of the whole population. The characteristics could be the total or mean value of an attribute regarding the population.^{15}^{16}

In spatial sampling, we collect samples in a two-dimensional framework. The sampling scheme is designed to maximize the probability of including the spatial variation of the study population.

There are different methods to collect a sample, in this guide we will focus and compare results between two sampling methods:

**Spatial random sampling**- randomly selecting sample points in a study region, where each location has an equal opportunity to be sampled.

**Spatial stratified sampling**- the study region is divided into groups a.k.a. strata by a collective characteristic of the study region (neighborhoods, land use, etc.). Then for each strata, a spatial random sample is collected and combined to one sample.^{17}

Therefore, to estimate the total renewable electricity potential for a city, we can collect samples of rooftop buildings using QGIS and QMS.

Important! to complete the analysis it is essential to have the total number of buildings in the city. This will be discussed in detail in section 4.4

### 4.1.1 Selecting a sample size

When planning a sampling framework the first expected question would be -
**What sample size should be used?**

To answer this question the following issues should be considered:

- What parameters do we want to estimate for the population
- How much is already known about the population
- Spread (variability) of the population
- Practicality: how hard is it to collect the sample data
- How precise we want the final estimates to be

There are various strategies to determine a sample size. We can use a census if we have a small population, use a sample size from a different analysis that is similar to ours, use published statistical tables and use a formula to calculate a sample size.^{18}

In addition, there is an online free calculator to estimate a suitable sample size here.

In this guide we will use the following formula to decide our sample size:

\[\begin{equation} n_0 = \frac{Z^2p(1-p)}{e^2} \tag{4.1} \end{equation}\]

Where \(n_0\) is the sample size, \(Z^2\) is the confidence level Z-score (can be found in this table), \(p\) is the estimated proportion of variability in the population and \(e^2\) is the margin of error, a.k.a. a confidence interval.

**Usually when we have a large population but we do not know the proportion of variability in the population therefore, we assume \(p=0.5\) (the maximum variability).

### 4.1.2 La Plata sample size calculation

For the city of La Plata, we will use formula (4.1) with a 5% confidence interval to estimate a suitable sample size.

\[\begin{equation} n_0 = \frac{1.96^2*0.5*(1-0.5)}{0.05^2} = 384.16 \tag{4.2} \end{equation}\]

Therefore the most suitable sample to collect for La Plata would be 384 building rooftops.

In this guide we will collect two spatial random samples - 100 samples, 300 samples, and both samples combined to observe the differences and select the most accurate approach when estimating renewable electricity potential for the whole city.

After spatial random sampling, we will examine the estimation of renewable electricity potential with spatial stratified sampling. The sample size for stratified sampling depends on the aforementioned issues. We can decide first on how to divide our buildings into strata and then use equation (4.1). In this guide we first compute 60 spatial random points in each strata for equal size stratification. Then we compute 95 spatial random points for the built up area and 5 points for the non built up area for optimal allocation stratification. The decision to use these sample sizes, is determined by the spread of the buildings in La Plata and the practicality of collecting the samples.

Thompson, S. (2012). Sampling. Hoboken, N.J.: Wiley.↩︎

Wang, J.-F., Stein, A., Gao, B.-B., Ge, Y., A review of spatial sampling. Spatial Statistics (2012), doi:10.1016/j.spasta.2012.08.001↩︎

Delmelle, E. (2012). Spatial Sampling. The SAGE Handbook Of Spatial Analysis, 182-206. doi: 10.4135/9780857020130.n10↩︎

Israel, G.D. (1992) Determining Sample Size. University of Florida Cooperative Extension Service, Institute of Food and Agriculture Sciences, EDIS, Florida.↩︎