Last data update: 2014.03.03

R: Individual contributions in regression
ind.contribR Documentation

Individual contributions in regression

Description

Computes difference in regression parameters when each individual is dropped, expressed in proportion of the whole regression coefficients. The function deals with lm (including glm) and least.rect models.

Usage

ind.contrib(model, print.diff = FALSE, graph = TRUE, warning=25)

Arguments

model

model (of class "lm" or "least.rect").

print.diff

logical. If TRUE results are printed.

graph

logical. If TRUE results are returned in a graphical way.

warning

level of graphical warning.

Value

coefficients

coefficients of each computed regression.

coefficients.diff

difference in coefficients between each computed regression and the whole regression.

coefficients.prop

difference in coefficients expressed in proportion of the whole regression coefficients.

Author(s)

Maxime Herv<c3><a9> <mx.herve@gmail.com>

See Also

lm.influence, least.rect

Examples

x <- 1:30
y <- 1:30+rnorm(30,0,4)
model1 <- lm(y~x)
model2 <- least.rect(y~x)
ind.contrib(model1)
ind.contrib(model2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RVAideMemoire)
*** Package RVAideMemoire v 0.9-56 ***
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RVAideMemoire/ind.contrib.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ind.contrib
> ### Title: Individual contributions in regression
> ### Aliases: ind.contrib
> 
> ### ** Examples
> 
> x <- 1:30
> y <- 1:30+rnorm(30,0,4)
> model1 <- lm(y~x)
> model2 <- least.rect(y~x)
> ind.contrib(model1)
$coefficients
(Intercept)           x 
  1.0728829   0.9166401 

$coefficients.diff
    (Intercept)             x
1  -0.306477659  1.482956e-02
2  -0.063906261  3.036016e-03
3   0.119533698 -5.561431e-03
4  -0.859895942  3.906045e-02
5   0.257849759 -1.139168e-02
6   0.370908747 -1.586031e-02
7   0.446456002 -1.836230e-02
8  -0.535624580  2.101404e-02
9   0.222640466 -8.238120e-03
10 -0.167462565  5.750536e-03
11  0.112126103 -3.487794e-03
12 -0.040749265  1.104174e-03
13  0.036655907 -8.062150e-04
14  0.185665342 -2.836992e-03
15 -0.023508699  1.421897e-04
16  0.012781374  9.514671e-05
17 -0.002111221 -6.129351e-05
18  0.024668166  1.705173e-03
19 -0.001708405 -2.893266e-04
20  0.005524578  4.811730e-03
21 -0.013904851  7.400969e-03
22  0.022809816 -5.739244e-03
23  0.102799424 -1.865312e-02
24  0.084174942 -1.258921e-02
25 -0.174632820  2.293565e-02
26 -0.115450192  1.380145e-02
27  0.228934149 -2.547816e-02
28  0.170167827 -1.789984e-02
29  0.111005389 -1.115563e-02
30 -0.251609569  2.434931e-02

$coefficients.prop
   (Intercept)            x
1  -28.5658077  1.382216503
2   -6.9717938  0.331211320
3   11.1413558 -0.518363327
4  -93.8095448  4.261263064
5   24.0333559 -1.061782201
6   40.4639435 -1.730266150
7   41.6127438 -1.711491881
8  -58.4334634  2.292507284
9   20.7516096 -0.767848933
10 -18.2691722  0.627349304
11  10.4509174 -0.325086140
12  -4.4455031  0.120458792
13   3.4165805 -0.075144731
14  20.2549871 -0.309498954
15  -2.1911711  0.013253051
16   1.3943721  0.010379941
17  -0.1967802 -0.005712973
18   2.6911506  0.186024234
19  -0.1592350 -0.026967213
20   0.6026987  0.524931146
21  -1.2960269  0.689820769
22   2.4884156 -0.626117468
23   9.5816073 -1.738598093
24   9.1829867 -1.373408563
25 -16.2769697  2.137758687
26 -12.5949309  1.505655872
27  21.3382238 -2.374737813
28  18.5643002 -1.952766505
29  10.3464592 -1.039780637
30 -27.4491110  2.656365576

> ind.contrib(model2)
$coefficients
(Intercept)           x 
 0.01720915  0.98474812 

$coefficients.diff
    (Intercept)             x
1  -0.160467330  0.0078322930
2   0.066381193 -0.0031386675
3   0.219896094 -0.0100184870
4  -0.928583915  0.0450803891
5   0.304897532 -0.0128030959
6   0.372616775 -0.0145585863
7   0.401850408 -0.0142739189
8  -0.606167922  0.0266082800
9   0.221716504 -0.0072085215
10 -0.152647791  0.0056295805
11  0.118243768 -0.0032034904
12 -0.027222263  0.0007644272
13  0.042826593 -0.0008254184
14  0.125881542  0.0012337227
15 -0.023448911  0.0002140122
16  0.011207632  0.0001209474
17 -0.004675029 -0.0001233728
18  0.015622581  0.0019111057
19 -0.004620396 -0.0006344615
20 -0.009822177  0.0051231228
21 -0.035418777  0.0079624778
22  0.008259425 -0.0057860624
23 -0.010334082 -0.0123860131
24  0.048759035 -0.0115730159
25 -0.227947708  0.0249790694
26 -0.100801031  0.0112047275
27  0.158953036 -0.0226329259
28  0.164402550 -0.0194654177
29  0.145989399 -0.0155913946
30 -0.199510083  0.0186057480

$coefficients.prop
     (Intercept)             x
1   -932.4533750   45.51236728
2      6.7409312   -0.31872795
3   1277.7856740  -58.21603714
4    -94.2965918    4.57785988
5   1771.7172248  -74.39701271
6     37.8387901   -1.47840712
7   2335.0969261  -82.94376066
8    -61.5556313    2.70203918
9   1288.3638233  -41.88771773
10   -15.5012016    0.57167720
11   687.0981203  -18.61503784
12    -2.7643884    0.07762667
13   248.8593855   -4.79639161
14    12.7831208    0.12528308
15  -136.2583658    1.24359539
16     1.1381217    0.01228207
17   -27.1659425   -0.71690250
18     1.5864546    0.19407051
19   -26.8484821   -3.68676795
20    -0.9974304    0.52024702
21  -205.8135960   46.26885315
22     0.8387348   -0.58756775
23   -60.0499154  -71.97340229
24     4.9514220   -1.17522599
25 -1324.5724827  145.14990428
26   -10.2362248    1.13782674
27   923.6540235 -131.51679001
28    16.6948834   -1.97669000
29   848.3241297  -90.59942927
30   -20.2600115    1.88939157

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>