Learn R Programming

sleuth (version 0.30.0)

sleuth_fit: Fit a measurement error model

Description

This function is a wrapper for fitting a measurement error model using sleuth. It performs the technical variance estimation from the boostraps, biological variance estimation, and shrinkage estimation.

Usage

sleuth_fit(obj, formula = NULL, fit_name = NULL, ...)

Arguments

obj

a sleuth object

formula

an R formula specifying the design to fit OR a design matrix. If you are interested in only fitting the model that was specified in sleuth_prep you do not need to specify it again (will be fit as the 'full' model).

fit_name

the name to store the fit in the sleuth object (at so$fits$fit_name). If NULL, the model will be named 'full'.

...

advanced options for sleuth_fit. See details.

Value

a sleuth object with updated attributes.

Details

For most users, simply providing the sleuth object should be sufficient. By default, this behavior will fit the full model initially specified and store it in the sleuth object under 'full'.

To see which models have been fit, users will likely find the function models helpful.

There are some advanced options for users how wish to customize the fitting procedure. Note that these options have not been thoroughly tested, so their effect on the accuracy of the results are unknown. Here are those advanced options:

Advanced options for modeling choice:

  • which_var: which kind of data (counts or TPMs) should be fit? Sleuth by default models the estimated counts, but can model the TPMs. This argument only accepts 'obs_counts' (default) or 'obs_tpm'. Note that if gene_mode is TRUE, and transcript counts were aggregated to the gene-level, 'obs_counts' will model the 'scaled_reads_per_base' summary statistic.

Advanced options for the sliding window shrinkage procedure (these options are passed to sliding_window_grouping):

  • n_bins: the number of bins that the data should be split for the sliding window shrinkage using the mean-variance curve. The default is 100.

  • lwr: the lower range of variances within each bin that should be included for the shrinkage procedure. The default is 0.25 (meaning the 25th percentile).

  • upr: the upper range of variances within each bin that should be included for the shrinkage procedure. The default is 0.75 (meaning the 75th percentile).

See Also

models for seeing which models have been fit, sleuth_prep for creating a sleuth object, sleuth_wt to test whether a coefficient is zero, sleuth_lrt to test nested models.

Examples

Run this code
# NOT RUN {
# If you specified the formula in sleuth_prep, you can simply run to run the full model
so <- sleuth_fit(so)
# The intercept only model can be fit like this
so <- sleuth_fit(so, ~1, 'reduced')
# }

Run the code above in your browser using DataLab