R: Model functions for data requiring ln-ln-transformation to...

models_lnln {bioset} | R Documentation

## Model functions for data requiring ln-ln-transformation to fit a model.

### Description

Use these functions to transform x and y using the natural logarithm and calculate a linear model, plot the model and use it to calculate x-values from the model data and y-values (inverse function).

Those function are intended to be used in set_calc_concentrations / sets_read to be applied to the calibrators (`fit_lnln`) and interpolate concentrations from the raw values (`interpolate_lnln`). Use `plot_lnln` to visually inspect goodness of fit.

- `fit_lnln`: Apply ln to x and y and calculate a linear model from x and y.

- `plot_lnln`: Draw the plot for the model that can be calculated with `fit_lnln`. Uses ggplot2::ggplot if available.

- `interpolate_lnln`: Inverse `fit_lnln` using `model` and calculate x values from y values.

### Usage

    fit_lnln(x, y)

    plot_lnln(x, y)

    interpolate_lnln(y, model)

### Arguments

`x` | The x coordinates of the points.
`y` | The y coordinates of the points.
`model` | The line model.

### Value

- `fit_lnln`: The model.

- `plot_lnln`: The plot.

- `interpolate_lnln`: The calculated x values.

### See Also

set_calc_concentrations, sets_read, models_linear

### Examples

    # generate data
    x <- c(2.718282, 20.085537, 54.598150, 1096.633158)
    # x is known for these values
    y_known <- c(33.11545, 665.14163, 2980.95799, 268337.28652)
    # we will calculate x for those:
    y_unknown <- c(148.4132, 13359.7268, 59874.1417)

    model <- fit_lnln(x = x, y = y_known)
    model

    plot_lnln(x = x, y = y_known)

    interpolate_lnln(y = y_unknown, model)

    rm(x, y_known, y_unknown, model)

[Package bioset version 0.2.2 Index]