DOptimality: Utility functions

Description Usage Arguments Details Value References Examples

View source: R/Doptimality.R

Description

Functions written in the pattern of the following utility.function can be used with optimiseSSNDesign. Off-the-shelf implementations are provided for the utility functions outlined in Falk et al. (2014) and modifications of these intended for creating adaptive designs.

Usage

1
2
DOptimality(ssn, glmssn, design.points, prior.parameters, n.draws,
  extra.arguments)

Arguments

ssn

An object of class SpatialStreamNetwork

glmssn

A fitted model object of class glmssn.

design.points

A vector of pids corresponding to a set of observed sites in the obspoints slot of the SpatialStreamNetwork object.

prior.parameters

A list of random functions that are parameterised in terms of n.draws.

n.draws

A numeric scalar for the number of Monte Carlo draws to use when approximating the utility.

extra.arguments

A list of extra parameters that control the behaviour of the utility function. The distance matrices required to compute covariance matrices are also stored in this list. Note that these are generated inside optimiseSSNDesign.

Details

The following utility functions have been implemented.

When the returned value is -1e9, this indicates the utility function has failed to compute.

Do not worry about passing arguments to this function. All arguments are handled internally by optimiseSSNDesign.

Value

A single number representing the expected utility for the design specified by design.points.

References

Falk, M., McGree, J.M., and Pettit, A.N. (2014). Sampling designs on stream networks using the pseudo-Bayesian approach. Environmental and Ecological Statistics, 21(4), 751-773.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 

# Create stream network
s <- createSSN(100, systematicDesign(0.25), 
path = paste(tempdir(), "s.ssn", sep = "/"), importToR = TRUE)
createDistMat(s)

# Simulate data on network
s <- SimulateOnSSN(s, getSSNdata.frame(s), 
formula = ~1, coefficients = 1, CorParms = c(1,2,1,2,1,2,0.1),
addfunccol = "addfunccol")$ssn.object

# Fit a model to the simulated data
m <- glmssn(Sim_Values ~ 1, s, addfunccol = "addfunccol")

# Define the priors on the covariance parameters
p <- constructLogNormalCovPriors(m)

# Find the optimal design using D-optimality as the utility function
r <- optimiseSSNDesign(s, paste(tempdir(), "r.ssn", sep = "/"),
 m, 25, utility.function = DOptimality, prior.parameters = p)

# Plot result to check
plot(r$ssn.new, "Sim_Values")


## End(Not run)

apear9/SSNdesign documentation built on Feb. 19, 2020, 4:29 a.m.