npseed: Set Random Seed

View source: R/util.R

npseedR Documentation

Set Random Seed

Description

npseed is a function which sets the random seed in the np C backend, resetting the random number generator.

Usage

npseed(seed)

Arguments

Seed Input

Seed value used to reset the package C backend random number generator.

seed

a single finite numeric value that is representable as a non-negative integer after applying abs().

Details

Documentation guide: see np.kernels for kernels, np.options for global options, and plot for plotting options.

npseed provides an interface for setting the random seed (and resetting the random number generator) used by np. The random number generator is used during the bandwidth search procedure to set the search starting point, and in subsequent searches when using multistarting, to avoid being trapped in local minima if the objective function is not globally concave.

Calling npseed will only affect the numerical search if it is performed by the C backend. The affected functions include: npudensbw, npcdensbw, npregbw, npplregbw, npqreg, npcmstest (via npregbw), npqcmstest (via npregbw), npsigtest (via npregbw).

Invalid inputs such as missing values, non-finite values, non-scalars, and values that cannot be represented as integers are rejected with an explicit error.

Value

None.

Note

This method currently only supports objects from the np library.

Author(s)

Tristen Hayfield tristen.hayfield@gmail.com, Jeffrey S. Racine racinej@mcmaster.ca

References

Li, Q. and J.S. Racine (2007), Nonparametric Econometrics: Theory and Practice, Princeton University Press.

See Also

np.kernels, np.options, plot set.seed

Examples

npseed(712)
x <- runif(10)
y <- x + rnorm(10, sd = 0.1)
bw <- npregbw(y~x)

np documentation built on May 3, 2026, 1:07 a.m.