nonlinEffect: Nonlinear Effects Plots

Description Usage Arguments Value Author(s) Examples

View source: R/plaqreffect.R

Description

Returns an object of class "plaqreffect" which represents the effect plot(s) of the nonlinear term(s) of a "plaqr" object from the plaqr function. A "plaqreffect" object should be plotted using the plot function.

Usage

1
nonlinEffect(fit, select=NULL, renames=NULL) 

Arguments

fit

a "plaqr" object.

select

a character vector with entries matching nonlinear terms in fit.

renames

a character vector with length equal to the number of nonlinear terms in select (if select is NULL, the length must be equal to the number of nonlinear terms in fit). The first entry renames the first nonlinear term for plotting purposes, and so on. Note that select can reorder the nonlinear terms (see the examples).

Value

A returned "plaqreffect" object to be used with the "plot" function. Each nonlinear term is associated with a list containing information for plotting. See the examples for accessing the list.

Author(s)

Adam Maidman

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(simData)
fit <- plaqr(y~.,~z1+z2,data=simData)

eff1 <- nonlinEffect(fit)
eff1
plot(eff1)

eff2 <- nonlinEffect(fit, select=c("z1","z2"), renames=c("Length", "Height"))
eff2
plot(eff2)

eff3 <- nonlinEffect(fit, select=c("z2","z1"), renames=c("Height", "Length"))
eff3
eff3$z1
eff3$z2
plot(eff3)

par(mfrow=c(1,2))
plot(eff3)

Example output

Loading required package: quantreg
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

Loading required package: splines
Call:
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)

Nonlinear Effects:
 z1 z2 
Call:
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)

Nonlinear Effects:
       z1 z2
Order:  1  2

Nonlinear Effects' Names:
       Length Height
Order:      1      2
Call:
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)

Nonlinear Effects:
       z2 z1
Order:  1  2

Nonlinear Effects' Names:
       Height Length
Order:      1      2
$z
               z      effect
1   0.6538007287 -4.07089678
2   0.4694366495  0.29089497
3   0.1784303838  4.20817275
4   0.1521782635  3.90418650
5   0.2493385819  4.31173414
6   0.8230156938 -4.93878470
7   0.0259540430 -0.05448917
8   0.1107352416  3.08755764
9   0.5477517569 -1.73522488
10  0.0230460255 -0.20109794
11  0.8972572836 -3.48632194
12  0.9246683815 -2.58095525
13  0.1361051225  3.63838969
14  0.8500553428 -4.56793467
15  0.6692729546 -4.32938018
16  0.1774439998  4.19955175
17  0.7311824269 -5.05331284
18  0.2821392375  4.05601481
19  0.5071285756 -0.69046359
20  0.3352853325  3.31607461
21  0.1076377528  3.00884335
22  0.3600352807  2.85851120
23  0.3070530710  3.75463313
24  0.0134199932 -0.70611820
25  0.9060440944 -3.21933474
26  0.4851607522 -0.11742769
27  0.7865274781 -5.18139851
28  0.7818600037 -5.19256828
29  0.6861739482 -4.57911031
30  0.3542267533  2.97143454
31  0.9911307523  0.56086834
32  0.1332740304  3.58502752
33  0.3890848455  2.24902721
34  0.4293141947  1.30584175
35  0.5788668597 -2.49840357
36  0.5937812072 -2.84600562
37  0.7910975034 -5.16625074
38  0.1903196406  4.29554972
39  0.4513471161  0.75483006
40  0.3055416483  3.77532476
41  0.8432054196 -4.67816215
42  0.1361735375  3.63965460
43  0.6976250724 -4.72732479
44  0.9771660175 -0.21722053
45  0.4090569988  1.79289504
46  0.1579808886  3.98497829
47  0.4334356962  1.20424738
48  0.6056215488 -3.11145917
49  0.0066424028 -1.08011527
50  0.4042595266  1.90485138
51  0.2738686344  4.13638339
52  0.8704125662 -4.17214200
53  0.5125680396 -0.83208045
54  0.4163602411  1.61983799
55  0.8899241076 -3.69282794
56  0.1836470361  4.25024628
57  0.2422089034  4.34398836
58  0.0607286149  1.49160726
59  0.0662715323  1.70384020
60  0.2002638753  4.34574807
61  0.4109192288  1.74906099
62  0.7883821037 -5.17575731
63  0.4964348241 -0.41151232
64  0.2778104707  4.09935982
65  0.0696555052  1.82893642
66  0.1768649716  4.19439174
67  0.0323193339  0.25689931
68  0.8905978682 -3.67446572
69  0.1987677754  4.33949850
70  0.5907388341 -2.77623443
71  0.8953962722 -3.54012186
72  0.9450734772 -1.76410244
73  0.0884275122  2.46262395
74  0.8947551530 -3.55843566
75  0.6269610070 -3.56249827
76  0.0160485110 -0.56518845
77  0.5472811281 -1.72336636
78  0.0299721262  0.14358808
79  0.7420299095 -5.12105097
80  0.7983876984 -5.13329784
81  0.7522596444 -5.16673381
82  0.1646281099  4.06791359
83  0.9940907201  0.73425032
84  0.0590949978  1.42730759
85  0.6188740626 -3.39602184
86  0.0383281247  0.53898633
87  0.2534057563  4.28945267
88  0.5611994911 -2.07048105
89  0.5250991695 -1.15688669
90  0.9604909490 -1.06202916
91  0.1174831379  3.25025996
92  0.8396883707 -4.73039588
93  0.3370588745  3.28541783
94  0.3939365295  2.14071733
95  0.2273445625  4.38238999
96  0.7889007418 -5.17405638
97  0.4497364387  0.79570812
98  0.3804529747  2.43738702
99  0.1541805223  3.93295787
100 0.0007400364 -1.41840576

$pp
              pp      effect
1   0.0007400364 -1.41840576
2   0.0107738817 -0.85030798
3   0.0208077269 -0.31581557
4   0.0308415722  0.18576598
5   0.0408754175  0.65513116
6   0.0509092628  1.09297446
7   0.0609431081  1.49999037
8   0.0709769534  1.87687338
9   0.0810107987  2.22431800
10  0.0910446440  2.54301871
11  0.1010784893  2.83367000
12  0.1111123346  3.09696638
13  0.1211461798  3.33360233
14  0.1311800251  3.54427234
15  0.1412138704  3.72967092
16  0.1512477157  3.89049255
17  0.1612815610  4.02743172
18  0.1713154063  4.14118293
19  0.1813492516  4.23244068
20  0.1913830969  4.30189945
21  0.2014169422  4.35025374
22  0.2114507875  4.37819804
23  0.2214846327  4.38642685
24  0.2315184780  4.37563466
25  0.2415523233  4.34651596
26  0.2515861686  4.29976525
27  0.2616200139  4.23607702
28  0.2716538592  4.15614575
29  0.2816877045  4.06066596
30  0.2917215498  3.95033212
31  0.3017553951  3.82583873
32  0.3117892404  3.68788029
33  0.3218230856  3.53715129
34  0.3318569309  3.37434622
35  0.3418907762  3.20015958
36  0.3519246215  3.01528585
37  0.3619584668  2.82041954
38  0.3719923121  2.61625513
39  0.3820261574  2.40348711
40  0.3920600027  2.18281000
41  0.4020938480  1.95491826
42  0.4121276933  1.72050640
43  0.4221615385  1.48026892
44  0.4321953838  1.23490030
45  0.4422292291  0.98509504
46  0.4522630744  0.73154763
47  0.4622969197  0.47495256
48  0.4723307650  0.21600433
49  0.4823646103 -0.04460257
50  0.4923984556 -0.30617364
51  0.5024323009 -0.56801440
52  0.5124661462 -0.82943034
53  0.5224999914 -1.08972698
54  0.5325338367 -1.34820982
55  0.5425676820 -1.60418437
56  0.5526015273 -1.85695614
57  0.5626353726 -2.10583063
58  0.5726692179 -2.35011335
59  0.5827030632 -2.58910981
60  0.5927369085 -2.82212551
61  0.6027707538 -3.04846595
62  0.6128045991 -3.26743666
63  0.6228384443 -3.47834313
64  0.6328722896 -3.68049086
65  0.6429061349 -3.87318538
66  0.6529399802 -4.05573217
67  0.6629738255 -4.22743676
68  0.6730076708 -4.38760464
69  0.6830415161 -4.53554133
70  0.6930753614 -4.67055232
71  0.7031092067 -4.79194314
72  0.7131430520 -4.89901927
73  0.7231768972 -4.99108624
74  0.7332107425 -5.06744954
75  0.7432445878 -5.12741469
76  0.7532784331 -5.17028719
77  0.7633122784 -5.19537254
78  0.7733461237 -5.20197626
79  0.7833799690 -5.18940385
80  0.7934138143 -5.15696081
81  0.8034476596 -5.10395266
82  0.8134815049 -5.02968490
83  0.8235153501 -4.93346304
84  0.8335491954 -4.81459258
85  0.8435830407 -4.67237903
86  0.8536168860 -4.50612790
87  0.8636507313 -4.31514470
88  0.8736845766 -4.09873492
89  0.8837184219 -3.85620409
90  0.8937522672 -3.58685769
91  0.9037861125 -3.29000125
92  0.9138199578 -2.96494027
93  0.9238538030 -2.61098025
94  0.9338876483 -2.22742670
95  0.9439214936 -1.81358513
96  0.9539553389 -1.36876104
97  0.9639891842 -0.89225995
98  0.9740230295 -0.38338735
99  0.9840568748  0.15855124
100 0.9940907201  0.73425032

$xlab
[1] "Length"

$ylab
[1] "y"

$tau
[1] 0.5

$var
[1] "z1"

$name
[1] "Length"

$call
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)

$formula
y ~ x1 + x2 + x3 + bs(z1) + bs(z2)

$z
              z       effect
1   -0.99548275 -4.491203501
2    0.48239604  0.868244032
3    0.86933100  3.196161657
4    0.47456762  0.841731582
5    0.85079763  3.029777696
6   -0.69446004 -1.826229486
7    0.38670053  0.585312600
8   -0.95982067 -4.083510818
9   -0.55112580 -1.081041005
10  -0.48025165 -0.808789885
11   0.19682337  0.234239120
12  -0.30702538 -0.351412277
13  -0.24864456 -0.248825187
14   0.85080258  3.029821270
15   0.08197461  0.106347730
16  -0.03176793  0.002617579
17  -0.16758761 -0.136556526
18  -0.11872564 -0.081447897
19   0.21325751  0.256376844
20   0.98610798  4.400668080
21  -0.24115682 -0.237116798
22   0.28196732  0.363619508
23   0.62646361  1.482476788
24   0.37305069  0.551707358
25   0.30201615  0.400064202
26  -0.66995302 -1.678340432
27  -0.97705735 -4.277147257
28   0.50508229  0.948763908
29  -0.41764748 -0.612802639
30  -0.12227055 -0.085202251
31   0.25888716  0.324712829
32  -0.25050675 -0.251784603
33  -0.45025657 -0.710040658
34  -0.74681847 -2.173372747
35  -0.79306714 -2.517397454
36  -0.38026686 -0.513344427
37   0.55471455  1.145100440
38  -0.71523594 -1.958783628
39   0.59963225  1.348483613
40  -0.03740852 -0.002509852
41   0.12572053  0.150525879
42  -0.95716168 -4.054201346
43   0.70466889  1.930884823
44  -0.18668903 -0.160375796
45  -0.48614873 -0.829306102
46   0.89879783  3.474225489
47  -0.66330701 -1.639775612
48  -0.40627840 -0.581243297
49  -0.15941747 -0.126792243
50   0.23285362  0.284419529
51   0.51205741  0.974651330
52  -0.07328611 -0.035932992
53  -0.68173366 -1.748305479
54  -0.76943134 -2.337051856
55  -0.68251370 -1.753011263
56   0.79912439  2.599244829
57  -0.28363030 -0.307770256
58  -0.59936337 -1.300753264
59   0.70979248  1.963441444
60   0.35830564  0.517109550
61   0.71939362  2.025550334
62   0.84803960  3.005567935
63   0.78428280  2.484359162
64  -0.61833572 -1.395450596
65   0.60695729  1.384108790
66  -0.02060898  0.012695586
67  -0.58409083 -1.227983014
68  -0.41267162 -0.598845524
69  -0.28700378 -0.313844831
70  -0.34044257 -0.420260833
71   0.73629789  2.138443339
72  -0.26241762 -0.271174330
73   0.09054546  0.114680895
74   0.43333221  0.712328664
75  -0.34334870 -0.426633361
76   0.91788924  3.663473633
77  -0.85174422 -3.007893302
78   0.54724694  1.113715084
79  -0.29935077 -0.336700152
80   0.88726358  3.363377165
81   0.44690464  0.753067818
82   0.91911635  3.675886714
83   0.19358342  0.230014119
84   0.22930781  0.279205952
85  -0.91915434 -3.651329217
86  -0.48324757 -0.819166523
87   0.04977469  0.076079690
88  -0.32148676 -0.380228590
89  -0.72253548 -2.006959731
90   0.63444153  1.524202371
91  -0.08562642 -0.047869735
92   0.58748402  1.290948811
93   0.34815068  0.494275230
94  -0.10631336 -0.068558412
95   0.72620708  2.070505711
96   0.04423250  0.071000089
97   0.63504253  1.527381340
98  -0.89395315 -3.400384476
99  -0.68148348 -1.746798149
100 -0.94295705 -3.900138525

$pp
              pp        effect
1   -0.995482752 -4.491204e+00
2   -0.975466684 -4.259012e+00
3   -0.955450616 -4.035419e+00
4   -0.935434548 -3.820249e+00
5   -0.915418480 -3.613326e+00
6   -0.895402412 -3.414474e+00
7   -0.875386344 -3.223516e+00
8   -0.855370276 -3.040276e+00
9   -0.835354208 -2.864579e+00
10  -0.815338140 -2.696249e+00
11  -0.795322072 -2.535108e+00
12  -0.775306004 -2.380982e+00
13  -0.755289936 -2.233693e+00
14  -0.735273868 -2.093067e+00
15  -0.715257800 -1.958927e+00
16  -0.695241732 -1.831096e+00
17  -0.675225664 -1.709399e+00
18  -0.655209596 -1.593660e+00
19  -0.635193528 -1.483703e+00
20  -0.615177460 -1.379351e+00
21  -0.595161392 -1.280428e+00
22  -0.575145324 -1.186759e+00
23  -0.555129256 -1.098167e+00
24  -0.535113188 -1.014476e+00
25  -0.515097120 -9.355102e-01
26  -0.495081052 -8.610935e-01
27  -0.475064984 -7.910497e-01
28  -0.455048916 -7.252029e-01
29  -0.435032848 -6.633768e-01
30  -0.415016781 -6.053954e-01
31  -0.395000713 -5.510826e-01
32  -0.374984645 -5.002624e-01
33  -0.354968577 -4.527586e-01
34  -0.334952509 -4.083952e-01
35  -0.314936441 -3.669961e-01
36  -0.294920373 -3.283852e-01
37  -0.274904305 -2.923865e-01
38  -0.254888237 -2.588238e-01
39  -0.234872169 -2.275211e-01
40  -0.214856101 -1.983023e-01
41  -0.194840033 -1.709913e-01
42  -0.174823965 -1.454120e-01
43  -0.154807897 -1.213884e-01
44  -0.134791829 -9.874440e-02
45  -0.114775761 -7.730385e-02
46  -0.094759693 -5.689072e-02
47  -0.074743625 -3.732892e-02
48  -0.054727557 -1.844237e-02
49  -0.034711489 -5.499294e-05
50  -0.014695421  1.800930e-02
51   0.005320647  3.592658e-02
52   0.025336715  5.387294e-02
53   0.045352783  7.202445e-02
54   0.065368851  9.055719e-02
55   0.085384919  1.096472e-01
56   0.105400987  1.294707e-01
57   0.125417055  1.502036e-01
58   0.145433123  1.720221e-01
59   0.165449191  1.951022e-01
60   0.185465259  2.196201e-01
61   0.205481327  2.457517e-01
62   0.225497395  2.736732e-01
63   0.245513463  3.035607e-01
64   0.265529531  3.355902e-01
65   0.285545599  3.699379e-01
66   0.305561667  4.067797e-01
67   0.325577735  4.462918e-01
68   0.345593803  4.886503e-01
69   0.365609871  5.340312e-01
70   0.385625939  5.826107e-01
71   0.405642007  6.345647e-01
72   0.425658075  6.900695e-01
73   0.445674143  7.493010e-01
74   0.465690211  8.124353e-01
75   0.485706279  8.796486e-01
76   0.505722347  9.511169e-01
77   0.525738415  1.027016e+00
78   0.545754483  1.107523e+00
79   0.565770551  1.192813e+00
80   0.585786619  1.283062e+00
81   0.605802687  1.378446e+00
82   0.625818755  1.479142e+00
83   0.645834823  1.585326e+00
84   0.665850891  1.697173e+00
85   0.685866959  1.814860e+00
86   0.705883027  1.938563e+00
87   0.725899095  2.068458e+00
88   0.745915163  2.204720e+00
89   0.765931231  2.347527e+00
90   0.785947299  2.497054e+00
91   0.805963367  2.653477e+00
92   0.825979435  2.816973e+00
93   0.845995503  2.987716e+00
94   0.866011571  3.165885e+00
95   0.886027639  3.351653e+00
96   0.906043707  3.545199e+00
97   0.926059775  3.746697e+00
98   0.946075843  3.956324e+00
99   0.966091911  4.174255e+00
100  0.986107979  4.400668e+00

$xlab
[1] "Height"

$ylab
[1] "y"

$tau
[1] 0.5

$var
[1] "z2"

$name
[1] "Height"

$call
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)

$formula
y ~ x1 + x2 + x3 + bs(z1) + bs(z2)

plaqr documentation built on May 2, 2019, 3:32 p.m.

Related to nonlinEffect in plaqr...