Learn R Programming

dbmss (version 1.2.4)

GlobalEnvelope: Estimation of the global confidence interval of a matrix of simulations

Description

Calculates the global confidence interval envelope sensu Duranton and Overman (2005) according to simulations of the null hypothesis of a function.

Usage

GlobalEnvelope(Simulations, Alpha)

Arguments

Simulations
A matrix containing the simulated values (each line is a simulation, each column a value of a function(R).
Alpha
The risk level.

Value

  • A list:
  • SimulationsA matrix containing the simulated values (each line is a simulation, each column a value of function(R)
  • MinA vector: the lower bound of the envelope
  • MaxA vector: the upper bound of the envelope

Details

The global enveloppe is calculated by iteration: the simulations reaching one of the upper or lower values at any distance are eliminated at each step. The process is repeated until Alpha / Number of simulations simulations are dropped. The remaining upper and lower bounds at all distances constitute the global envelope. Interpolation is used if the exact ratio cannot be reached. It is an alternative to the classical way to compute local confidence intervals (see KEnvelope for example.

References

Duranton, G. and Overman, H. G. (2005). Testing for Localisation Using Micro-Geographic Data. Review of Economic Studies 72(4): 1077-1106.

See Also

KdEnvelope

Examples

Run this code
data(paracou16)
# Keep only 20% of points to run this example
X <- rthin(paracou16, 0.2)

# Calculate Kd
r <- 0:100
ActualValues.X <- Kd.r(X, r, "Q. Rosea", "Q. Rosea")

# Calculate confidence envelope (should be 1000 simulations, reduced to 20 to save time)
NumberOfSimulations <- 20
Alpha <- .20
LocalEnvelope.X <- KdEnvelope(NumberOfSimulations, Alpha, X, r, "Q. Rosea", "Q. Rosea")
GlobalEnvelope.X <- GlobalEnvelope(LocalEnvelope.X$Simulations, Alpha)

# Plot
PlotResults(r, ActualValues.X, LocalEnvelope.X, GlobalEnvelope.X, ylab="Kd", Legend=TRUE, 
    LegendItems=c("Kd", "Local CI", "Global CI"), LegendPosition="bottomright")

Run the code above in your browser using DataLab