bayesPF: Fits a psychometric function

Description Usage Arguments Examples

View source: R/bayesPF.R

Description

Fits a psychometric function

Usage

1
2
3
bayesPF(formula, data, link, adaptive_pooling = FALSE, chains = 1,
  iter = 2000, warmup = 1000, thin = 1, cores = 1, ...,
  sample = TRUE)

Arguments

formula

A formula that one would pass to 'glm' or similar

data

A data.frame object

link

A link function (either "logit" or "probit")

adaptive_pooling

Logical (FALSE by default) Specifies whether adaptive pooling should be used when fitting the model. Requires that both an intecept and at least one factor variable is included in the formula.

...

Other parameters to be passed to 'rstan::stan()'.

sample

Logical. Whether to sample from the model or just build the model without sampling

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Load the data
data_binomial  <- Sample_Data_Binomial
data_bernoulli <- Sample_Data_Bernoulli

# Fit a full model using binomial response data. By default, it will only
# return the posterior samples for the coefficients
fit1.1 <- bayesPF(y|k ~ x1 + age + gender, data_binomial, "logit",
                  chains = 2, cores = 2, iter = 8000, warmup = 2000)

str(fit1.1)

# Fit a full model using binary response data. To get the fitted Stan
# model, specify `return_stan_fit = TRUE`. To get diagnostic information
# such as the Stan code and transformed data, specify `return_f2stan = TRUE`
fit1.2 <- bayesPF(y ~ x1 + age + gender, data_bernoulli, "probit",
                  return_f2stan = TRUE, return_stan_fit = TRUE)
str(fit1.2)
extract(fit1.2$fit)

adknudson/BayesPsychometric documentation built on Nov. 22, 2019, 1:59 p.m.