Learn R Programming

aridagri (version 2.0.3)

path_analysis: Path Coefficient Analysis

Description

Performs path analysis to determine direct and indirect effects of independent variables on a dependent variable. Essential for understanding yield contributing factors.

Usage

path_analysis(data, dependent, independent, digits = 4, verbose = TRUE)

Value

List with direct effects, indirect effects, and correlation breakdown

Arguments

data

Data frame with numeric variables

dependent

Name of dependent variable (e.g., "yield")

independent

Character vector of independent variable names

digits

Number of decimal places

verbose

Logical. If TRUE (default), prints formatted output to console.

Author

Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner

Examples

Run this code
data <- data.frame(
  yield = c(1200, 1350, 1100, 1450, 1280, 1380, 1220, 1400),
  pods = c(45, 52, 42, 58, 48, 54, 46, 56),
  seeds = c(8.2, 9.1, 7.8, 9.5, 8.5, 9.0, 8.3, 9.3),
  weight = c(32, 35, 30, 38, 33, 36, 31, 37)
)
path_analysis(data, dependent = "yield", 
              independent = c("pods", "seeds", "weight"))

Run the code above in your browser using DataLab