Second version of
someCPairs also allows input matrix of
control variables, produce 7 column matrix
summarizing the results where the signs of
stochastic dominance order values (+1 or -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.
The weighting is obviously not needed for the third criterion Cr3.
1 2 3 4 5 6 7 8 9
The data matrix with many columns where the first column is fixed and then paired with all other columns, one by one.
data matrix for designated control variable(s) outside causal paths
Number of digits for reporting (default
Allows user to choose a vector of four alternative weights for SD1 to SD4.
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 source of slightly declining sampling
unreliability of higher moments is the
higher power of the deviations from the mean needed in their computations.
The summary results for all
three criteria are reported in one matrix called
(typ=1) reports ('Y', 'X', 'Cause', 'SD1.rhserr', 'SD2.rhserr', 'SD3.rhserr', 'SD4.rhserr') naming variables identifying the 'cause' and measures of stochastic dominance using absolute values of kernel regression abs(RHS first regressor*residual) values comparing flipped regressions X on Y versus Y on X. The letter C in the titles reminds presence of control variable(s).
typ=2 reports ('Y', 'X', 'Cause', 'SD1resC', 'SD2resC', 'SD3resC', 'SD4resC') and measures of stochastic dominance using absolute values of kernel regression residuals comparing regression of X on Y with that of Y on X.
typ=3 reports ('Y', 'X', 'Cause', 'r*x|yC', 'r*y|xC', 'r', 'p-val') containing generalized correlation coefficients r*, 'r' refers to. Pearson correlation coefficient p-val is the p-value for testing the significance of 'r'. The letter C in the titles reminds the presence of control variable(s).
Prints three matrices detailing results for Cr1, Cr2 and Cr3.
It also returns a grand summary matrix called ‘outVote’ which summarizes all three criteria.
In general, a positive sign for weighted sum reported in the column ‘sum’ means
that the first variable listed as the input to this function is the ‘kernel cause.’
This function is an extension of
some0Pairs to allow for control variables.
For example, crime ‘kernel causes’ police officer deployment (not vice versa) is indicated by
the positive sign of ‘sum’ (=3.175) reported for that example included in this package.
The output matrix last column for ‘mtcars’ example has the sum of the scores by the three criteria combined. If ‘sum’ is positive, then variable X (mpg) is more likely to have been engineered to kernel cause the response variable Y, rather than vice versa.
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.
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: 10.1080/03610918.2015.1122048
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
## Not run: someCPairs2(mtcars[,1:3],ctrl=mtcars[4:5]) # first variable is mpg and effect on mpg is of interest ## End(Not run) ## Not run: 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=NA;y2=y;y2=NA;w2=w;w2=NA someCPairs2(cbind(x2,y2), cbind(z,w2)) #yields x2 as correct cause ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.