Title: | Confirmatory Path Analysis Through 'd-sep' Tests |
---|---|
Description: | Functions to test and compare causal models using Confirmatory Path Analysis. |
Authors: | Alessandro Bellino [cre, aut], Daniela Baldantoni [aut] |
Maintainer: | Alessandro Bellino <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2024-12-03 06:49:31 UTC |
Source: | CRAN |
The package includes functions to test and compare causal models
Package: | cpa |
Type: | Package |
Version: | 1.0.1 |
Date: | 2022-06-04 |
License: | GPL (>= 2) |
For usage, see the documentation of the main function 'cpa'
Alessandro Bellino and Daniela Baldantoni
Maintainer: Alessandro Bellino <[email protected]>
Bellino A, Baldantoni D, De Nicola F, Iovieno P, Zaccardelli M, Alfani A. (2015) Compost amendments in agricultural ecosystems: confirmatory path analysis to clarify the effects on soil chemical and biological properties. Journal of Agricultural Science 253,282–295
ggm
x <- cpa()
x <- cpa()
Each row of the dataframe is a vector of two elements (cause,effect). The dataframe contains the list of the direct causal interactions for the model developed by Bellino and co-workers (2015).
Dataframe with 2 columns and 46 rows
Bellino A, Baldantoni D, De Nicola F, Iovieno P, Zaccardelli M, Alfani A. (2015) Compost amendments in agricultural ecosystems: confirmatory path analysis to clarify the effects on soil chemical and biological properties. Journal of Agricultural Science 253,282–295
cpa
performs a confiratory path analysis on causal hypotheses
expressed as directed acyclic graphs (DAGs) through the use of d-sep
tests.
cpa()
cpa()
The function builds a graphical user interface to load the necessary files and perform the analyses. The user is asked to supply a data matrix, a list with the direct interactions implied by a given DAG and the list of variables included in the DAG. The data matrix and the list of the direct interactions should be comma-separated text files. Each direct interaction is coded as a vector of two elements, the first of which is the causal parent (the cause) and the second one the causal child (the effect). Once the files are loaded, it is possible to plot the DAG and start the analyses.
The script, sequentially, builds the basis set, performs the conditional independence tests and the Fisher's C test, calculates the Akaike's Information Criterium according to Shipley (2013), and performs the structural regressions implied by the given DAG. For an in-depth description of the code, the algorithms and the calculations refer to Bellino and co-workers (2015).
The function returns an environment containing (if any) a set of user-defined environments. The user is asked to discard or save the results of each analysis, which will be then stored in an environment containing the following objects:
C |
Value of the Fisher's C statistics |
P |
Null probability of the Fisher's C test |
AIC |
Akaike's Information Criterium |
Bu |
Table with the conditional independence claims and the null probability associated |
Ti |
List containing the conditional independence tests |
Ti_summary |
List containing the summaries of the conditional independence tests |
dctests |
List containing the linear models that fit the structural equations implied by the DAG. The names of its elements are the corresponding dependent variables of each model |
dctests_summary |
List containing the summaries of the linear models contained in 'dctests' |
Alessandro Bellino and Daniela Baldantoni
Bellino A, Baldantoni D, De Nicola F, Iovieno P, Zaccardelli M, Alfani A. (2015) Compost amendments in agricultural ecosystems: confirmatory path analysis to clarify the effects on soil chemical and biological properties. Journal of Agricultural Science 253,282–295
Shipley B. (2013) The AIC model selection method applied to path analytic models compared using a d-separation test. Ecology 94 (3), 560–564.
basisSet
and shipley.test
functions of package ggm
for an
alternative way to perform the Fisher's C test
## Start the GUI and save the results of the analyses in an environment x <- cpa() ## Inspect the content of the environment, it will contain every ## user-defined environment in which the results of each performed ## analysis are stored. ls(x)
## Start the GUI and save the results of the analyses in an environment x <- cpa() ## Inspect the content of the environment, it will contain every ## user-defined environment in which the results of each performed ## analysis are stored. ls(x)
This dataset was used in Bellino et al. (2015) to develop and test a causal model describing the dynamics of some soil properties following repeated compost amendments.
Dataframe with 12 obervations and 16 variables, with two missing data.
Bellino A, Baldantoni D, De Nicola F, Iovieno P, Zaccardelli M, Alfani A. 2015 Compost amendments in agricultural ecosystems: confirmatory path analysis to clarify the effects on soil chemical and biological properties. Journal of Agricultural Science 253,282–295
The dataframe contains the names of variables in the dataset Data.
Dataframe with 1 column and 16 rows
Bellino A, Baldantoni D, De Nicola F, Iovieno P, Zaccardelli M, Alfani A. (2015) Compost amendments in agricultural ecosystems: confirmatory path analysis to clarify the effects on soil chemical and biological properties. Journal of Agricultural Science 253,282–295