samplePPMix: Take Observations from Points and Polygons within the latent...

Description Usage Arguments Value Examples

View source: R/samplePPMix.R

Description

Takes binomial trials from a probability field created by simField randomly from the field where each observation takes place at the point level and then p replaced with representative polygon data.

Usage

1
2
samplePPMix(field, N, M, times = NULL, p = 0.5, polygonList = NULL,
  rWidth = NULL, replace = TRUE, ...)

Arguments

field

field object which simulated underlying data

N

int, Number of points sampled for each polygon

M

int, Number of trials for each point

times

vector of int, times to sample from

p

numeric >0 & <=1, percentage of polygons sampled

polygonList

list, list of polygons to sample from

rWidth

integer, instead of using a polygon list divide the original bounding box into approximately equal sized squares with rWidth number squares along the x axis.

replace

logical, replace values in the sampling

...

further argumnets for compatibility

Value

list of data.frames with observation number, number of trials, and the id of the pixel that the trail took place in.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
require(sp)

set.seed(123)
unitSim <- simField(
    N = 300, 
    offset = c(0.1, 0.2), 
    max.edge = c(0.05,0.2),
    beta0 = -2,
    betaList = list(
        list(type="random", value=2),
        list(type="spatial", value=-.5),
        list(type="cluster", value=-2)
    ))

mixSample <- samplePPMix(unitSim, 30, 150, p=.5, rWidth=3)
head(mixSample$pointDF)
head(mixSample$polyDF)

nmmarquez/PointPolygon documentation built on Dec. 10, 2020, 1:15 a.m.