brms_custom_family {neodistr}R Documentation

Neonormal as custom distribution family in brms

Description

Neonormal as custom distribution family in brms

Usage

brms_custom_family(family = "msnburr", vectorize = TRUE)

Arguments

family

distribution neo-normal option: "msnburr", "msnburr2a", "gmsnburr", and "jfst"

vectorize

logical; if TRUE, Stan code of family distribution is vectorize The default value of this parameter is TRUE

Value

custom_family is an object of class custom family of brms and stanvars_family is stanvars object (the Stan code of function of neo-normal distributions (lpdf,cdf,lcdf,lccdf,quantile and rng))

Author(s)

Achmad Syahrul Choir

Examples


  library(brms)
  library(neodistr)
  x<-runif(100)
  e<-rmsnburr(100,0,1,0.8)
  y<-0.5+0.8*x+e
  data<-data.frame(y,x)
  msnburr<-brms_custom_family("msnburr")
  fit <- brm(
    y ~ x, data = data,
    family = msnburr$custom_family, stanvars = msnburr$stanvars_family,
    prior=c(set_prior("cauchy(0,5)",class="alpha"),set_prior("cauchy(0,1)",class="sigma"))
  )
  summary(fit)
  pp <- posterior_predict(fit)
  ppe <- posterior_epred(fit)
  loo(fit)
  

[Package neodistr version 0.1.1 Index]