Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/causeSummary2.R

The algorithm determines causal path directions from the sign of the strength index and strength index values by comparing three aspects of flipped kernel regressions: [x1 on f(x2, x3, .. xp)] and its flipped version [x2 on f(x1, x3, .. xp)] We compare (i) formal exogeneity test criterion, (ii) absolute residuals, and (iii) R-squares of the flipped regressions implying three criteria Cr1, to Cr3. The criteria are quantified by newer exact methods using four orders of stochastic dominance, SD1 to SD4. See Vinod (2021) SSRN papers. In portfolio applications of stochastic dominance one wants higher values. Here we are comparing two probability distributions of absolute residuals for two flipped models. We choose that flip which has smaller absolute residuals which will have a better fit.

1 | ```
causeSummary2(mtx, nam = colnames(mtx), ctrl = 0, dig = 6)
``` |

`mtx` |
The data matrix with many columns, y the first column is fixed and then paired with all columns, one by one, and still called x for the purpose of flipping. |

`nam` |
vector of column names for |

`ctrl` |
data matrix for designated control variable(s) outside causal paths |

`dig` |
Number of digits for reporting (default |

If there are p columns in the input matrix, x1, x2, .., xp, say,
and if we keep x1 as a common member of all causal direction pairs
(x1, x(1+j)) for (j=1, 2, .., p-1) which can be flipped. That is, either x1 is
the cause or x(1+j) is the cause in a chosen pair.
The control
variables are not flipped. The printed output of this function
reports the results for p-1 pairs indicating which variable
(by name) causes which another variable (also by name).
It also prints a signed summary strength index in the range [-100,100].
A positive sign of the strength index means x1 kernel causes x(1+j),
whereas negative strength index means x(1+j) kernel causes x1. The function
also prints Pearson correlation and its p-value. In short, function returns
a matrix of p-1 rows and 5 columns entitled:
“cause", “response", “strength", “corr." and “p-value", respectively
with self-explanatory titles. The first two columns have names of variables
x1 or x(1+j), depending on which is the cause. The ‘strength’ column
reports the absolute value of summary index, in the range [0,100]
providing summary of causal results
based on preponderance of evidence from Cr1 to Cr3
from four orders of stochastic dominance, moments, deciles
etc. The order of input columns in mtx matters.
The fourth column ‘corr.’ of ‘out’ reports the Pearson correlation coefficient while
the fifth column has the p-value for testing the null of zero Pearson coeff.
This function calls `silentPair2`

allowing for control variables.
The output of this function can be sent to ‘xtable’ for a nice Latex table.

The European Crime data has all three criteria correctly suggesting that
high crime rate kernel causes the deployment of a large number of police officers.
Since Cr1 to Cr3 near unanimously suggest ‘crim’ as the cause of ‘off’,
strength index 100 suggests unanimity among the criteria.
`attach(EuroCrime); causeSummary(cbind(crim,off))`

Prof. H. D. Vinod, Economics Dept., Fordham University, NY.

Vinod, H. D. 'Generalized Correlation and Kernel Causality with Applications in Development Economics' in Communications in Statistics -Simulation and Computation, 2015, doi: gffn86

Vinod, H. D. 'New exogeneity tests and causal paths,' Chapter 2 in 'Handbook of Statistics: Conceptual Econometrics Using R', Vol.32, co-editors: H. D. Vinod and C.R. Rao. New York: North Holland, Elsevier Science Publishers, 2019, pp. 33-64.

Vinod, H. D. Causal Paths and Exogeneity Tests in Generalcorr Package for Air Pollution and Monetary Policy (June 6, 2017). Available at SSRN: https://www.ssrn.com/abstract=2982128

Vinod, Hrishikesh D., R Package GeneralCorr Functions for Portfolio Choice (November 11, 2021). Available at SSRN: https://ssrn.com/abstract=3961683

Vinod, Hrishikesh D., Stochastic Dominance Without Tears (January 26, 2021). Available at SSRN: https://ssrn.com/abstract=3773309

See `siPair2Blk`

for a block version

See `causeSummary`

is subject to trapezoidal approximation.

see `silentPair2`

called by this function.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## Not run:
mtx=as.matrix(mtcars[,1:3])
ctrl=as.matrix(mtcars[,4:5])
causeSummary2(mtx,ctrl,nam=colnames(mtx))
## End(Not run)
options(np.messages=FALSE)
set.seed(234)
z=runif(10,2,11)# z is independently created
x=sample(1:10)+z/10 #x is somewhat indep and affected by z
y=1+2*x+3*z+rnorm(10)
w=runif(10)
x2=x;x2[4]=NA;y2=y;y2[8]=NA;w2=w;w2[4]=NA
causeSummary2(mtx=cbind(x2,y2), ctrl=cbind(z,w2))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.