profile_residuals: Calculate Pearson profile residuals

Description Usage Arguments Details Value References See Also Examples

View source: R/residuals.R

Description

Residuals are calculated using the formula

(y_i - E[y_i]) / √{E[y]_i}

which treats each element of the citation counts vector as a Poisson variate. If the expected value is zero, NA is returned. (You can decide for yourself whether to omit these observations, treat them as zero or use some other approach.)

Usage

1
profile_residuals(expected, observed)

Arguments

expected

Predicted vector of citations, based on some model

observed

Vector of observed citations from the journal of interest

Details

We might want to make a generic S3 function like stats::residuals(). Deviance residuals may be added later. For now we have Pearson residuals only.

Value

A numeric vector of standardised residuals, the same length as expected and observed

References

Agresti, Alan (2002). Categorical Data Analysis (2nd ed., pp. 366–367). New York, NY: Wiley.

See Also

stats::rstandard.glm()

Other functions for residual analysis of communities: community_residuals, fitted_citations

Examples

1
2
3
4
5
# Compare citations of 'Biometrika' to those of all stats journals
Bka_counts <- citations[, 'Bka']
average_profile <- rowSums(citations) / sum(citations)
expected_counts <- average_profile * sum(Bka_counts)
profile_residuals(expected_counts, Bka_counts)

Selbosh/scrooge documentation built on May 5, 2019, 8 p.m.