If the cause and effect relationship is well defined, it is possible to represent the whole system of variables in a diagram form known as path-analysis. The function calculates the direct and indirect effects and uses the variables correlation or covariance.
path.analysis(corr.x, corr.y)
corr.x | Matrix of correlations of the independent variables |
---|---|
corr.y | vector of dependent correlations with each one of the independent ones |
Direct and indirect effects and residual Effect^2.
It is necessary first to calculate the correlations.
Biometrical Methods in Quantitative Genetic Analysis, Singh, Chaudhary. 1979
# Path analysis. Multivarial Analysis. Anderson. Prentice Hall, pag 616 library(agricolae) # Example 1 corr.x<- matrix(c(1,0.5,0.5,1),c(2,2)) corr.y<- rbind(0.6,0.7) names<-c("X1","X2") dimnames(corr.x)<-list(names,names) dimnames(corr.y)<-list(names,"Y") path.analysis(corr.x,corr.y)#> Direct(Diagonal) and indirect effect path coefficients #> ====================================================== #> X1 X2 #> X1 0.3333333 0.2666667 #> X2 0.1666667 0.5333333 #> #> Residual Effect^2 = 0.4266667# Example 2 # data of the progress of the disease related bacterial wilt to the ground # for the component CE Ca K2 Cu data(wilt) data(soil) x<-soil[,c(3,12,14,20)] y<-wilt[,14] cor.y<-correlation(y,x)$correlation cor.x<-correlation(x)$correlation path.analysis(cor.x,cor.y)#> Direct(Diagonal) and indirect effect path coefficients #> ====================================================== #> EC Ca K2 Cu #> EC -0.19495296 -0.08486615 -0.06659364 0.006412745 #> Ca -0.04483918 -0.36898324 -0.05327491 -0.022902662 #> K2 -0.08772883 -0.13283397 -0.14798587 -0.011451331 #> Cu 0.02729341 -0.18449162 -0.03699647 -0.045805324 #> #> Residual Effect^2 = 0.6856863