REMOVE dataVector positionVector resultVariable

Copies all elements of dataVector, except those specified by the positionVector, into resultVariable. The input vector is left unchanged.

The elements of the input data vector are numbered starting with one, i.e., the first element of the input data vector is element number one.

The positionVector contains a list of the position numbers in the input vector that are not to be copied to the resultVariable.

Any position number that refers to a position not in the input, such as a negative position number or one that is greater than the length of the input vector, will cause a runtime error and abort the program.

Duplicate position numbers are ignored. Each position number value is only used once even if it appears more than once.

The REMOVE command can be helpful in writing programs implementing the "Jackknife" technique. See second example at right.

The REMOVE command is the complement, or inverse, of the TAKE command.

See also: TAKE

COPY (12 8 10 4 6 2) data
REMOVE data (1 3 5) selectedData
PRINT selectedData

The above program produces the following output:

selectedData: (8.0 4.0 2.0)

Here is a more practical example:

' Randomly select 20 counties in the United States and
' record their populations. Use that sample to estimate,
' within a 95% confidence interval, the mean population
' for all counties in the US. Use the jackknife technique
' instead of the bootstrap.
COPY (30083 152585 50917 300836 98928 6179 \
93145 32273 460 16754 26147 14194 11355 \
76779 7129 7021 32343 352910 51150 \
14632) countySample

NEWCMD JACKKNIFE dataVector scores \
  ?"Performs jackknife algorithm using MEAN"
   CLEAR scores
   SIZE dataVector size
   FOREACH position 1,size
      REMOVE dataVector position newSample
      MEAN newSample newSampleMean
      SCORE newSampleMean scores

'Example of use:
JACKKNIFE countySample means
PERCENTILE means (2.5 97.5) confidenceInterval 
PRINT confidenceInterval%8.2F

The above program produces the following output:

confidenceInterval: (53837.37 72387.37)