Skip to contents

This function calculates the Binary Power Law (BPL) parameters for spatial disease patterns, fits a linear model, and performs a hypothesis test for the slope.

Usage

BPL(data)

Arguments

data

A data frame containing the following columns:

  • field: The field identifier.

  • n: The number of observations in each quadrat.

  • i: The incidence count in each quadrat.

Value

A list containing the following elements:

  • summary: A data frame summarizing the input data by field, including total observations (n_total), mean incidence (incidence_mean), observed variance (V), and binomial variance (Vbin).

  • model_summary: A summary of the linear model fitted to the log-transformed variances.

  • hypothesis_test: The result of the hypothesis test for the slope being equal to 1.

  • ln_Ap: The intercept of the linear model, representing the natural logarithm of the parameter \( A_p \).

  • slope: The slope of the linear model.

Details

The function performs the following steps:

  1. Summarizes the data by field to calculate the total number of observations (n_total), mean incidence (incidence_mean), observed variance (V), and binomial variance (Vbin).

  2. Log-transforms the variances.

  3. Fits a linear model to the log-transformed variances.

  4. Tests the hypothesis that the slope of the linear model is equal to 1.

Examples

if (FALSE) {
# Example usage with a sample data frame
result <- BPL(FHBWheat)
print(result$summary)
print(result$model_summary)
print(result$hypothesis_test)
print(paste("ln(Ap):", result$ln_Ap))
print(paste("Slope (b):", result$slope))
}