View source: R/causeSummary0.R
causeSummary0 | R Documentation |
Allowing input matrix of control variables, this function produces
a 5 column matrix
summarizing the results where the estimated signs of
stochastic dominance order values, (+1, 0, -1), are weighted by
wt=c(1.2,1.1, 1.05, 1)
to
compute an overall result for all orders of stochastic dominance by
a weighted sum for
the criteria Cr1 and Cr2 and added to the Cr3 estimate as: (+1, 0, -1).
The final range for the unanimity of sign index is [–100, 100].
causeSummary0(
mtx,
nam = colnames(mtx),
ctrl = 0,
dig = 6,
wt = c(1.2, 1.1, 1.05, 1),
sumwt = 4
)
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 |
wt |
Allows user to choose a vector of four alternative weights for SD1 to SD4. |
sumwt |
Sum of weights can be changed here =4(default). |
The reason for slightly declining weights on the signs from
SD1 to SD4 is simply that the local mean comparisons
implicit in SD1 are known to be
more reliable than local variance implicit in SD2, local skewness implicit in
SD3 and local kurtosis implicit in SD4. The reason for
slightly declining sampling
unreliability of higher moments is simply that SD4 involves fourth power
of the deviations from the mean and SD3 involves 3rd power, etc.
The summary results for all
three criteria are reported in one matrix called out
:
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 other variable (also by name).
It also prints strength or signed summary strength index in 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. This function also 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
has absolute value of summary index in range [0,100]
providing summary of causal results
based on preponderance of evidence from Cr1 to Cr3
from four orders of stochastic dominance, etc. The order of input columns matters.
The fourth column ‘corr.’ reports the Pearson correlation coefficient while
the fifth column has the p-value for testing the null of zero Pearson coeff.
This function calls silentPairs0
(the older version) 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.
attach(EuroCrime); causeSummary0(cbind(crim,off))
. Both versions
give identical result for this example. Old version of Cr1 using
gradients was also motivated by the same Hausman-Wu test statistic.
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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03610918.2015.1122048")}
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
See bootPairs
See someCPairs
silentPairs
## Not run:
mtx=as.matrix(mtcars[,1:3])
ctrl=as.matrix(mtcars[,4:5])
causeSummary0(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
causeSummary0(mtx=cbind(x2,y2), ctrl=cbind(z,w2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.