# Predict from a `ww_area_of_applicability`

Source: `R/area_of_applicability.R`

`predict.ww_area_of_applicability.Rd`

Predict from a `ww_area_of_applicability`

## Usage

```
# S3 method for ww_area_of_applicability
predict(object, new_data, ...)
```

## Arguments

- object
A

`ww_area_of_applicability`

object.- new_data
A data frame or matrix of new samples.

- ...
Not used.

## Value

A tibble of predictions, with two columns: `di`

, numeric, contains the
"dissimilarity index" of each point in `new_data`

, while `aoa`

, logical,
contains whether a row is inside (`TRUE`

) or outside (`FALSE`

) the area of
applicability.

Note that this function is often called using
`terra::predict()`

, in which case `aoa`

will be converted to numeric
implicitly; `1`

values correspond to cells "inside" the area of applicability
and `0`

corresponds to cells "outside" the AOA.

The number of rows in the tibble is guaranteed
to be the same as the number of rows in `new_data`

. Rows with `NA`

predictor
values will have `NA`

`di`

and `aoa`

values.

## Details

The function computes the distance indices of the new data and whether or not they are "inside" the area of applicability.

## See also

Other area of applicability functions:
`ww_area_of_applicability()`

## Examples

```
library(vip)
#>
#> Attaching package: ‘vip’
#> The following object is masked from ‘package:utils’:
#>
#> vi
train <- gen_friedman(1000, seed = 101) # ?vip::gen_friedman
test <- train[701:1000, ]
train <- train[1:700, ]
pp <- stats::ppr(y ~ ., data = train, nterms = 11)
importance <- vi_permute(
pp,
target = "y",
metric = "rsquared",
pred_wrapper = predict
)
aoa <- ww_area_of_applicability(y ~ ., train, test, importance = importance)
predict(aoa, test)
#> # A tibble: 300 × 2
#> di aoa
#> <dbl> <lgl>
#> 1 0.175 TRUE
#> 2 0.191 TRUE
#> 3 0.190 TRUE
#> 4 0.0802 TRUE
#> 5 0.141 TRUE
#> 6 0.287 TRUE
#> 7 0.178 TRUE
#> 8 0.205 TRUE
#> 9 0.134 TRUE
#> 10 0.177 TRUE
#> # ℹ 290 more rows
```