Skip to contents

Implementation of equation 4 in the paper.

Usage

RegSDCipso(y, x = NULL, ensureIntercept = TRUE)

Arguments

y

Matrix of confidential variables

x

Matrix of non-confidential variables

ensureIntercept

Whether to ensure/include a constant term. Non-NULL x is subjected to EnsureIntercept

Value

Generated version of y

Details

Input matrices are subjected to EnsureMatrix.

Author

Øyvind Langsrud

Examples

x <- matrix(1:5, 5, 1)
y <- matrix(rnorm(15) + 1:15, 5, 3)
ySynth <- RegSDCipso(y, x)

# Identical regression results
summary(lm(y[, 1] ~ x))
#> 
#> Call:
#> lm(formula = y[, 1] ~ x)
#> 
#> Residuals:
#>       1       2       3       4       5 
#> -1.1012  0.9930  0.8082 -0.1907 -0.5093 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)  
#> (Intercept)   0.7162     1.0743   0.667   0.5527  
#> x             0.8419     0.3239   2.599   0.0804 .
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 1.024 on 3 degrees of freedom
#> Multiple R-squared:  0.6925,	Adjusted R-squared:   0.59 
#> F-statistic: 6.756 on 1 and 3 DF,  p-value: 0.08044
#> 
summary(lm(ySynth[, 1] ~ x))
#> 
#> Call:
#> lm(formula = ySynth[, 1] ~ x)
#> 
#> Residuals:
#>       1       2       3       4       5 
#> -0.6954  0.1954  1.4436 -0.6917 -0.2519 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)  
#> (Intercept)   0.7162     1.0743   0.667   0.5527  
#> x             0.8419     0.3239   2.599   0.0804 .
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 1.024 on 3 degrees of freedom
#> Multiple R-squared:  0.6925,	Adjusted R-squared:   0.59 
#> F-statistic: 6.756 on 1 and 3 DF,  p-value: 0.08044
#> 

# Identical covariance matrices
cov(y) - cov(ySynth)
#>               [,1]          [,2]          [,3]
#> [1,] -8.881784e-16 -1.776357e-15 -3.108624e-15
#> [2,] -1.776357e-15 -1.776357e-15 -4.440892e-15
#> [3,] -3.108624e-15 -4.440892e-15 -8.881784e-15
cov(residuals(lm(y ~ x))) - cov(residuals(lm(ySynth ~ x)))
#>               [,1]          [,2]          [,3]
#> [1,] -1.110223e-16 -3.400058e-16  5.828671e-16
#> [2,] -3.400058e-16  5.551115e-16  1.665335e-16
#> [3,]  5.828671e-16  1.665335e-16 -3.608225e-16