Deming: Model object, ready for sampling

Description Public fields Active bindings Methods Examples

Description

Deming facilitates a non-parametric check of neuromodulation. This class is a wrapper around a cmdstanr::CmdStanModel class.

Public fields

cmdstanr_version

Version of cmdstanr used to build models

cmdstan_version

Version of cmdstan used to build models

Active bindings

standata

used to fit model

prior

used to fit model

cmdstanmodel

Underlying cmdstanr::CmdStanModel

Methods

Public methods


Method new()

Initialize new instance of class Deming

Usage
Deming$new(d, x, y, tuning_var, id_var, prior = DemingPrior$new())
Arguments
d

dataframe from which to make standata.

x, y

Names of columns in d which contain the x and y values

tuning_var

Name of column across which there was testing

id_var

Name of column indexing ids

prior

A DemingPrior

Examples
m <- sub02 |>
     tidyr::pivot_wider(names_from = contrast, values_from = y) |>
     dplyr::mutate(orientation = factor(orientation)) |>
     Deming$new(low, high, tuning_var = orientation, id_var = voxel)
m

m$cmdstanmodel

Method make_standata()

Prepare data for running model

Usage
Deming$make_standata(d, x, y, tuning_var, id_var)
Arguments
d

dataframe from which to make standata.

x, y

Names of columns in d which contain the x and y values.

tuning_var

Name of column across which there was testing. Column must be a factor.

id_var

Name of column indexing units (e.g., voxels, cells). Column must be a factor.

Returns

named list


Method sample()

Draw samples from the posterior of the model

Usage
Deming$sample(...)
Arguments
...

arguments passed to cmdstanr::sample().

Returns

An object of class cmdstanr::CmdStanMCMC


Method clone()

The objects of this class are cloneable with this method.

Usage
Deming$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## ------------------------------------------------
## Method `Deming$new`
## ------------------------------------------------

m <- sub02 |>
     tidyr::pivot_wider(names_from = contrast, values_from = y) |>
     dplyr::mutate(orientation = factor(orientation)) |>
     Deming$new(low, high, tuning_var = orientation, id_var = voxel)
m

m$cmdstanmodel

psadil/nmmr documentation built on June 13, 2021, 11:42 a.m.