nlme_gastempt | R Documentation |
Compute coefficients v0, tempt and kappa of a mixed model fit to a linexp function with one grouping variable
nlme_gastempt(d, pnlsTol = 0.001, model = linexp, variant = 1)
d |
A data frame with columns
|
pnlsTol |
The value of pnlsTol at the initial iteration.
See |
model |
|
variant |
For both models, there are 3 variants
|
A list of class nlme_gastempt with elements
coef, summary, plot, pnlsTol, message
coef
is a data frame with columns:
record
Record descriptor, e.g. patient ID
v0
Initial volume at t=0
tempt
Emptying time constant
kappa
Parameter kappa
for
model = linexp
beta
Parameter beta
for model = powexp
t50
Half-time of emptying
slope_t50
Slope in t50; typically in units of ml/minute
On error, coef is NULL
nlme_result
Result of the nlme fit; can be used for addition
processing, e.g. to plot residuals or via summary
to extract AIC.
On error, nlme_result is NULL.
plot
A ggplot graph of data and prediction. Plot of raw data is
returned even when convergence was not achieved.
pnlsTol
Effective value of pnlsTo after convergence or failure.
message
String "Ok" on success, and the error message of
nlme
on failure.
suppressWarnings(RNGversion("3.5.0")) set.seed(4711) d = simulate_gastempt(n_record = 10, kappa_mean = 0.9, kappa_std = 0.3, model = linexp)$data fit_d = nlme_gastempt(d) # fit_d$coef # direct access coef(fit_d) # better use accessor function coef(fit_d, signif = 3) # Can also set number of digits # Avoid ugly ggplot shading (not really needed...) library(ggplot2) theme_set(theme_bw() + theme(panel.spacing = grid::unit(0,"lines"))) # fit_d$plot # direct access is possible plot(fit_d) # better use accessor function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.