someCPairs2: Kernel causality computations admitting control variables...

someCPairs2R Documentation

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.


  dig = 6,
  verbo = TRUE,
  rnam = FALSE,
  wt = c(1.2, 1.1, 1.05, 1),
  sumwt = 4



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 dig=6).


Make verbo= TRUE for printing detailed steps.


Make rnam= TRUE if cleverly created rownames are desired.


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 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', '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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03610918.2015.1122048")}

See Also

See Also somePairs, some0Pairs


## 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: 
z=runif(10,2,11)# z is independently created
x=sample(1:10)+z/10  #x is somewhat indep and affected by z
someCPairs2(cbind(x2,y2), cbind(z,w2)) #yields x2 as correct cause

## End(Not run)

generalCorr documentation built on May 1, 2023, 9:06 a.m.