R: Prediction for a fitted affinity textmodel

predict.textmodel_affinity {quanteda.textmodels} | R Documentation

## Prediction for a fitted affinity textmodel

### Description

Estimate θ_i for each document, from a fitted textmodel_affinity object.

Other methods below provide standard ways to extract or compute quantities from predicted textmodel_affinity objects.

### Usage

    ## S3 method for class 'textmodel_affinity'
    predict(object, newdata = NULL, level = 0.95, ...)

    ## S3 method for class 'predict.textmodel_affinity'
    coef(object, ...)

    ## S3 method for class 'predict.textmodel_affinity'
    residuals(object, type = c("response", "pearson"), ...)

    ## S3 method for class 'predict.textmodel_affinity'
    rstandard(model, ...)

### Arguments

`object` | a fitted affinity textmodel
`newdata` | dfm on which prediction should be made
`level` | probability level for confidence interval width
`...` | unused
`type` | see residuals.lm

### Value

`predict()` returns a list of predicted affinity textmodel quantities.

`coef()` returns a document \times class matrix of class affinities for each document.

`residuals()` returns a document-by-feature matrix of residuals. `resid()` is an alias.

`rstandard()` is a shortcut to return the pearson residuals.

### See Also

`influence.predict.textmodel_affinity()` for methods of computing the influence of particular features from a predicted textmodel_affinity model.

[Package quanteda.textmodels version 0.9.4 Index]