Boltzmann: Fit a Boltzmann function to data

BoltzmannR Documentation

Fit a Boltzmann function to data

Description

#' [Experimental]
The Boltzmann method fits a Boltzmann function to data stored in a PRecording object. Therefore, values from the stimulus (usually voltage) and response (usually current) traces are averaged between the indicated time windows on a per-sweep basis. Internally, the boltzmann_fit function is called to perform the actual fitting.

The boltzmann_fit function fits a Boltzmann function to voltage and conductance data (V and G). It is normally called internally from the Boltzmann method to perform the actual fitting, but can also be called directly. It estimates the parameters Vhalf, k, and G_max that best fit the data. The Boltzmann function is defined as:

(G_max - 0) / (1 + exp((Vhalf - V) / k))

and thus assumes that virtually all channels are in the closed state at the most negative voltage values.

Usage

Boltzmann(
  X,
  StimTrace = "V-mon",
  RespTrace = "I-mon",
  Time_Range_Stim = c(1.18, 1.19),
  Time_Range_Tail_Start = c(1.203, 1.204),
  Time_Range_Tail_End = c(1.33, 1.38),
  precision = 3,
  ReturnPObject = T,
  ...
)

boltzmann_fit(
  V,
  G,
  start_Vhlaf = V[which.min(abs(normalize(G) - 0.5))],
  start_k = estimate_slope(V, G),
  start_G_max = max(G) * 1.1,
  lower_Vhalf = min(V),
  lower_G_max = mean(G[seq(length(G) - round(length(G)/4), length(G))]) * 0.75,
  upper_Vhalf = max(V)
)

Arguments

X

PRecording object

StimTrace

The name of the trace that contains the stimulus

RespTrace

The name of the trace that contains the response

Time_Range_Stim

A numeric vector specifying the time range for the stimulus trace .

Time_Range_Tail_Start

A numeric vector specifying the time range for measuring the tail current in the response trace.

Time_Range_Tail_End

A numeric vector specifying the time range for measuring the leak current in the response trace (usually end of the voltage step eliciting the tail currents).

precision

An integer specifying the precision for rounding the stimulus values.

ReturnPObject

whether to return a PRecording/PCollection or a matrix.

V

A numeric vector representing the voltage values.

G

A numeric vector representing the conductance values.

start_k

The initial estimate for k. Defaults to the estimated slope of the data within a specified range using the estimate_slope function.

start_G_max

The initial estimate for G_max. Defaults to 1.1 times the maximum G value.

lower_Vhalf

The lower bound for Vhalf. Defaults to the minimum V value.

lower_G_max

The lower bound for G_max. Defaults to 0.75 times the mean of G values in the last quarter of the data.

upper_Vhalf

The upper bound for Vhalf. Defaults to the maximum V value.

start_Vhalf

The initial estimate for Vhalf. Defaults to the V value corresponding to G closest to 0.5 when normalized.

Value

For Boltzmann(): A PRecording or PCollection, respectively. In PRecording the Fit Slot will be added a list item termed Boltzmann containing the modeled fit and the MetaData Slot will contain additional columns as described below. In PCollection objects, a V_half column will be added to the MetaData Slot. If ReturnPObject=F a data.frame will be returned, as described below.

V

The voltage values from the input data.

G

The conductance values from the input data.

G.norm

The normalized conductance values calculated using the fitted Boltzmann function.

G.predicted

The predicted conductance values from the fitted Boltzmann function at the V values.

G.predicted.norm

The normalized predicted conductance values from the fitted Boltzmann function at the V values.

The data.frame also includes the following attributes:

Vhalf

The estimated Vhalf parameter of the Boltzmann function.

k

The estimated k parameter of the Boltzmann function.

G_max

The estimated G_max parameter of the Boltzmann function.

For boltzmann_fit(): An object of class "nls" representing the fitted Boltzmann function.

Functions

  • boltzmann_fit: Fit a Boltzmann function to voltage and conductance data.

Examples


######
                
V <- c(1, 2, 3, 4, 5)
G <- c(0.1, 0.3, 0.5, 0.7, 0.9)
fit <- boltzmann_fit(V, G)



moritzlindner/PatchR documentation built on April 30, 2024, 1:40 a.m.