Description Usage Arguments Details Value Author(s) Examples
Interfaces to nlme
functions that can be used
in a pipeline implemented by magrittr
.
1 2 3 4 5 |
data |
data frame, tibble, list, ... |
... |
Other arguments passed to the corresponding interfaced function. |
Interfaces call their corresponding interfaced function.
Object returned by interfaced function.
Roberto Bertolusso
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | ## Not run:
library(intubate)
library(magrittr)
library(nlme)
## gls
## Original function to interface
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
correlation = corAR1(form = ~ 1 | Mare))
summary(fm1)
## The interface reverses the order of data and formula
fm1 <- ntbt_gls(Ovary, follicles ~ sin(2*pi*Time) + cos(2*pi*Time),
correlation = corAR1(form = ~ 1 | Mare))
summary(fm1)
## so it can be used easily in a pipeline.
Ovary %>%
ntbt_gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time),
correlation = corAR1(form = ~ 1 | Mare)) %>%
summary()
## nlme
## Original function to interface
lme(distance ~ age, data = Orthodont) # random is ~ age
lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
## The interface reverses the order of data and formula
ntbt_lme(data = Orthodont, distance ~ age) # random is ~ age
ntbt_lme(data = Orthodont, distance ~ age + Sex, random = ~ 1)
## so it can be used easily in a pipeline.
Orthodont %>%
ntbt_lme(distance ~ age) # random is ~ age
Orthodont %>%
ntbt_lme(distance ~ age + Sex, random = ~ 1)
## lmList
## Original function to interface
lmList(distance ~ age | Subject, Orthodont)
## The interface reverses the order of data and formula
ntbt_lmList(Orthodont, distance ~ age | Subject)
## so it can be used easily in a pipeline.
Orthodont %>%
ntbt_lmList(distance ~ age | Subject)
Orthodont %>%
ntbt_lmList(distance ~ age | Subject) %>%
summary()
## nlme
## Original function to interface
fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
data = Loblolly,
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
summary(fm1)
## The interface reverses the order of data and formula
fm1 <- ntbt_nlme(data = Loblolly,
height ~ SSasymp(age, Asym, R0, lrc),
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
summary(fm1)
## so it can be used easily in a pipeline.
Loblolly %>%
ntbt_nlme(height ~ SSasymp(age, Asym, R0, lrc),
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3)) %>%
summary()
## End(Not run)
|
Generalized least squares fit by REML
Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
Data: Ovary
AIC BIC logLik
1571.455 1590.056 -780.7273
Correlation Structure: AR(1)
Formula: ~1 | Mare
Parameter estimate(s):
Phi
0.7532079
Coefficients:
Value Std.Error t-value p-value
(Intercept) 12.216398 0.6646437 18.380373 0.0000
sin(2 * pi * Time) -2.774712 0.6450478 -4.301561 0.0000
cos(2 * pi * Time) -0.899605 0.6975383 -1.289685 0.1981
Correlation:
(Intr) s(*p*T
sin(2 * pi * Time) 0.000
cos(2 * pi * Time) -0.294 0.000
Standardized residuals:
Min Q1 Med Q3 Max
-2.41180365 -0.75405234 -0.02923628 0.63156880 3.16247697
Residual standard error: 4.616172
Degrees of freedom: 308 total; 305 residual
Generalized least squares fit by REML
Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
Data: NULL
AIC BIC logLik
1571.455 1590.056 -780.7273
Correlation Structure: AR(1)
Formula: ~1 | Mare
Parameter estimate(s):
Phi
0.7532079
Coefficients:
Value Std.Error t-value p-value
(Intercept) 12.216398 0.6646437 18.380373 0.0000
sin(2 * pi * Time) -2.774712 0.6450478 -4.301561 0.0000
cos(2 * pi * Time) -0.899605 0.6975383 -1.289685 0.1981
Correlation:
(Intr) s(*p*T
sin(2 * pi * Time) 0.000
cos(2 * pi * Time) -0.294 0.000
Standardized residuals:
Min Q1 Med Q3 Max
-2.41180365 -0.75405234 -0.02923628 0.63156880 3.16247697
Residual standard error: 4.616172
Degrees of freedom: 308 total; 305 residual
Generalized least squares fit by REML
Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
Data: NULL
AIC BIC logLik
1571.455 1590.056 -780.7273
Correlation Structure: AR(1)
Formula: ~1 | Mare
Parameter estimate(s):
Phi
0.7532079
Coefficients:
Value Std.Error t-value p-value
(Intercept) 12.216398 0.6646437 18.380373 0.0000
sin(2 * pi * Time) -2.774712 0.6450478 -4.301561 0.0000
cos(2 * pi * Time) -0.899605 0.6975383 -1.289685 0.1981
Correlation:
(Intr) s(*p*T
sin(2 * pi * Time) 0.000
cos(2 * pi * Time) -0.294 0.000
Standardized residuals:
Min Q1 Med Q3 Max
-2.41180365 -0.75405234 -0.02923628 0.63156880 3.16247697
Residual standard error: 4.616172
Degrees of freedom: 308 total; 305 residual
Linear mixed-effects model fit by REML
Data: Orthodont
Log-restricted-likelihood: -221.3183
Fixed: distance ~ age
(Intercept) age
16.7611111 0.6601852
Random effects:
Formula: ~age | Subject
Structure: General positive-definite
StdDev Corr
(Intercept) 2.3270338 (Intr)
age 0.2264276 -0.609
Residual 1.3100399
Number of Observations: 108
Number of Groups: 27
Linear mixed-effects model fit by REML
Data: Orthodont
Log-restricted-likelihood: -218.7563
Fixed: distance ~ age + Sex
(Intercept) age SexFemale
17.7067130 0.6601852 -2.3210227
Random effects:
Formula: ~1 | Subject
(Intercept) Residual
StdDev: 1.807425 1.431592
Number of Observations: 108
Number of Groups: 27
Linear mixed-effects model fit by REML
Data: Orthodont
Log-restricted-likelihood: -221.3183
Fixed: distance ~ age
(Intercept) age
16.7611111 0.6601852
Random effects:
Formula: ~age | Subject
Structure: General positive-definite
StdDev Corr
(Intercept) 2.3270338 (Intr)
age 0.2264276 -0.609
Residual 1.3100399
Number of Observations: 108
Number of Groups: 27
Linear mixed-effects model fit by REML
Data: Orthodont
Log-restricted-likelihood: -218.7563
Fixed: distance ~ age + Sex
(Intercept) age SexFemale
17.7067130 0.6601852 -2.3210227
Random effects:
Formula: ~1 | Subject
(Intercept) Residual
StdDev: 1.807425 1.431592
Number of Observations: 108
Number of Groups: 27
Linear mixed-effects model fit by REML
Data: .
Log-restricted-likelihood: -221.3183
Fixed: distance ~ age
(Intercept) age
16.7611111 0.6601852
Random effects:
Formula: ~age | Subject
Structure: General positive-definite
StdDev Corr
(Intercept) 2.3270338 (Intr)
age 0.2264276 -0.609
Residual 1.3100399
Number of Observations: 108
Number of Groups: 27
Linear mixed-effects model fit by REML
Data: .
Log-restricted-likelihood: -218.7563
Fixed: distance ~ age + Sex
(Intercept) age SexFemale
17.7067130 0.6601852 -2.3210227
Random effects:
Formula: ~1 | Subject
(Intercept) Residual
StdDev: 1.807425 1.431592
Number of Observations: 108
Number of Groups: 27
Call:
Model: distance ~ age | Subject
Data: Orthodont
Coefficients:
(Intercept) age
M16 16.95 0.550
M05 13.65 0.850
M02 14.85 0.775
M11 20.05 0.325
M07 14.95 0.800
M08 19.75 0.375
M03 16.00 0.750
M12 13.25 1.000
M13 2.80 1.950
M14 19.10 0.525
M09 14.40 0.975
M15 13.50 1.125
M06 18.95 0.675
M04 24.70 0.175
M01 17.30 0.950
M10 21.25 0.750
F10 13.55 0.450
F09 18.10 0.275
F06 17.00 0.375
F01 17.25 0.375
F05 19.60 0.275
F07 16.95 0.550
F02 14.20 0.800
F08 21.45 0.175
F03 14.40 0.850
F04 19.65 0.475
F11 18.95 0.675
Degrees of freedom: 108 total; 54 residual
Residual standard error: 1.31004
Call:
Model: distance ~ age | Subject
Data: Orthodont
Coefficients:
(Intercept) age
M16 16.95 0.550
M05 13.65 0.850
M02 14.85 0.775
M11 20.05 0.325
M07 14.95 0.800
M08 19.75 0.375
M03 16.00 0.750
M12 13.25 1.000
M13 2.80 1.950
M14 19.10 0.525
M09 14.40 0.975
M15 13.50 1.125
M06 18.95 0.675
M04 24.70 0.175
M01 17.30 0.950
M10 21.25 0.750
F10 13.55 0.450
F09 18.10 0.275
F06 17.00 0.375
F01 17.25 0.375
F05 19.60 0.275
F07 16.95 0.550
F02 14.20 0.800
F08 21.45 0.175
F03 14.40 0.850
F04 19.65 0.475
F11 18.95 0.675
Degrees of freedom: 108 total; 54 residual
Residual standard error: 1.31004
Call:
Model: distance ~ age | Subject
Data: .
Coefficients:
(Intercept) age
M16 16.95 0.550
M05 13.65 0.850
M02 14.85 0.775
M11 20.05 0.325
M07 14.95 0.800
M08 19.75 0.375
M03 16.00 0.750
M12 13.25 1.000
M13 2.80 1.950
M14 19.10 0.525
M09 14.40 0.975
M15 13.50 1.125
M06 18.95 0.675
M04 24.70 0.175
M01 17.30 0.950
M10 21.25 0.750
F10 13.55 0.450
F09 18.10 0.275
F06 17.00 0.375
F01 17.25 0.375
F05 19.60 0.275
F07 16.95 0.550
F02 14.20 0.800
F08 21.45 0.175
F03 14.40 0.850
F04 19.65 0.475
F11 18.95 0.675
Degrees of freedom: 108 total; 54 residual
Residual standard error: 1.31004
Call:
Model: distance ~ age | Subject
Data: .
Coefficients:
(Intercept)
Estimate Std. Error t value Pr(>|t|)
M16 16.95 3.288173 5.1548379 3.695247e-06
M05 13.65 3.288173 4.1512411 1.181678e-04
M02 14.85 3.288173 4.5161854 3.458934e-05
M11 20.05 3.288173 6.0976106 1.188838e-07
M07 14.95 3.288173 4.5465974 3.116705e-05
M08 19.75 3.288173 6.0063745 1.665712e-07
M03 16.00 3.288173 4.8659237 1.028488e-05
M12 13.25 3.288173 4.0295930 1.762580e-04
M13 2.80 3.288173 0.8515366 3.982319e-01
M14 19.10 3.288173 5.8086964 3.449588e-07
M09 14.40 3.288173 4.3793313 5.509579e-05
M15 13.50 3.288173 4.1056231 1.373664e-04
M06 18.95 3.288173 5.7630783 4.078189e-07
M04 24.70 3.288173 7.5117696 6.081644e-10
M01 17.30 3.288173 5.2612799 2.523621e-06
M10 21.25 3.288173 6.4625549 3.065505e-08
F10 13.55 3.288173 4.1208291 1.306536e-04
F09 18.10 3.288173 5.5045761 1.047769e-06
F06 17.00 3.288173 5.1700439 3.499774e-06
F01 17.25 3.288173 5.2460739 2.665260e-06
F05 19.60 3.288173 5.9607565 1.971127e-07
F07 16.95 3.288173 5.1548379 3.695247e-06
F02 14.20 3.288173 4.3185072 6.763806e-05
F08 21.45 3.288173 6.5233789 2.443813e-08
F03 14.40 3.288173 4.3793313 5.509579e-05
F04 19.65 3.288173 5.9759625 1.863600e-07
F11 18.95 3.288173 5.7630783 4.078189e-07
age
Estimate Std. Error t value Pr(>|t|)
M16 0.550 0.2929338 1.8775576 6.584707e-02
M05 0.850 0.2929338 2.9016799 5.361639e-03
M02 0.775 0.2929338 2.6456493 1.065760e-02
M11 0.325 0.2929338 1.1094659 2.721458e-01
M07 0.800 0.2929338 2.7309929 8.511442e-03
M08 0.375 0.2929338 1.2801529 2.059634e-01
M03 0.750 0.2929338 2.5603058 1.328807e-02
M12 1.000 0.2929338 3.4137411 1.222240e-03
M13 1.950 0.2929338 6.6567951 1.485652e-08
M14 0.525 0.2929338 1.7922141 7.870160e-02
M09 0.975 0.2929338 3.3283976 1.577941e-03
M15 1.125 0.2929338 3.8404587 3.247135e-04
M06 0.675 0.2929338 2.3042752 2.508117e-02
M04 0.175 0.2929338 0.5974047 5.527342e-01
M01 0.950 0.2929338 3.2430540 2.030113e-03
M10 0.750 0.2929338 2.5603058 1.328807e-02
F10 0.450 0.2929338 1.5361835 1.303325e-01
F09 0.275 0.2929338 0.9387788 3.520246e-01
F06 0.375 0.2929338 1.2801529 2.059634e-01
F01 0.375 0.2929338 1.2801529 2.059634e-01
F05 0.275 0.2929338 0.9387788 3.520246e-01
F07 0.550 0.2929338 1.8775576 6.584707e-02
F02 0.800 0.2929338 2.7309929 8.511442e-03
F08 0.175 0.2929338 0.5974047 5.527342e-01
F03 0.850 0.2929338 2.9016799 5.361639e-03
F04 0.475 0.2929338 1.6215270 1.107298e-01
F11 0.675 0.2929338 2.3042752 2.508117e-02
Residual standard error: 1.31004 on 54 degrees of freedom
Nonlinear mixed-effects model fit by maximum likelihood
Model: height ~ SSasymp(age, Asym, R0, lrc)
Data: Loblolly
AIC BIC logLik
239.4856 251.6397 -114.7428
Random effects:
Formula: Asym ~ 1 | Seed
Asym Residual
StdDev: 3.650642 0.7188625
Fixed effects: Asym + R0 + lrc ~ 1
Value Std.Error DF t-value p-value
Asym 101.44960 2.4616951 68 41.21128 0
R0 -8.62733 0.3179505 68 -27.13420 0
lrc -3.23375 0.0342702 68 -94.36052 0
Correlation:
Asym R0
R0 0.704
lrc -0.908 -0.827
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.23601930 -0.62380854 0.05917466 0.65727206 1.95794425
Number of Observations: 84
Number of Groups: 14
Nonlinear mixed-effects model fit by maximum likelihood
Model: height ~ SSasymp(age, Asym, R0, lrc)
Data: Loblolly
AIC BIC logLik
239.4856 251.6397 -114.7428
Random effects:
Formula: Asym ~ 1 | Seed
Asym Residual
StdDev: 3.650642 0.7188625
Fixed effects: Asym + R0 + lrc ~ 1
Value Std.Error DF t-value p-value
Asym 101.44960 2.4616951 68 41.21128 0
R0 -8.62733 0.3179505 68 -27.13420 0
lrc -3.23375 0.0342702 68 -94.36052 0
Correlation:
Asym R0
R0 0.704
lrc -0.908 -0.827
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.23601930 -0.62380854 0.05917466 0.65727206 1.95794425
Number of Observations: 84
Number of Groups: 14
Nonlinear mixed-effects model fit by maximum likelihood
Model: height ~ SSasymp(age, Asym, R0, lrc)
Data: .
AIC BIC logLik
239.4856 251.6397 -114.7428
Random effects:
Formula: Asym ~ 1 | Seed
Asym Residual
StdDev: 3.650642 0.7188625
Fixed effects: Asym + R0 + lrc ~ 1
Value Std.Error DF t-value p-value
Asym 101.44960 2.4616951 68 41.21128 0
R0 -8.62733 0.3179505 68 -27.13420 0
lrc -3.23375 0.0342702 68 -94.36052 0
Correlation:
Asym R0
R0 0.704
lrc -0.908 -0.827
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.23601930 -0.62380854 0.05917466 0.65727206 1.95794425
Number of Observations: 84
Number of Groups: 14
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.