Kernel causality computations admitting control variables reporting a 7-column matrix, version 2.
Kernel causality computations admitting control variables reporting a 7-column matrix, version 2.
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.
mtx: The data matrix with many columns where the first column is fixed and then paired with all other columns, one by one.
ctrl: data matrix for designated control variable(s) outside causal paths
dig: Number of digits for reporting (default dig=6).
verbo: Make verbo= TRUE for printing detailed steps.
rnam: Make rnam= TRUE if cleverly created rownames are desired.
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).
Returns
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 some0Pairsto allow for control variables. For example, crimekernel 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.
Details
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 outVote:
(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', 'rx|yC', 'ry|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).
Note
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.
Examples
## 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 createdx=sample(1:10)+z/10#x is somewhat indep and affected by zy=1+2*x+3*z+rnorm(10)w=runif(10)x2=x;x2[4]=NA;y2=y;y2[8]=NA;w2=w;w2[4]=NAsomeCPairs2(cbind(x2,y2), cbind(z,w2))#yields x2 as correct cause## End(Not run)
References
Vinod, H. D. 'Generalized Correlation and Kernel Causality with Applications in Development Economics' in Communications in Statistics -Simulation and Computation, 2015, tools:::Rd_expr_doi("10.1080/03610918.2015.1122048")
See Also
See Also somePairs, some0Pairs
Author(s)
Prof. H. D. Vinod, Economics Dept., Fordham University, NY.