Family objects provide a convenient way to specify the details
of the models used by netReg
.
See also stats::family
for more details.
family(object, ...) gaussian(link = c("identity")) binomial(link = c("logit", "probit", "log")) poisson(link = c("log")) gamma(link = c("inverse")) beta(link = c("logit", "probit", "log")) inverse.gaussian(link = c("1/mu^2"))
object | a object for which the family shoulr be retured
(e.g. |
---|---|
... | further arguments passed to methods |
link | name of a link function |
An object of class netReg.family
name of the family
name of the link function
inverse link function
loss function
gaussian()#> family: gaussian #> link: identitybinomial("probit")$link#> [1] "probit"poisson()$linkinv#> function (x) #> tf$maximum(tf$exp(x), tf$float32$min) #> <bytecode: 0x5578c5d265e0> #> <environment: namespace:netReg>gamma()$linkinv#> Warning: family gamma is still experimental. enjoy with care.#> function (x) #> 1/x #> <bytecode: 0x5578c5d938d8> #> <environment: namespace:netReg>beta()$loss#> Warning: family beta is still experimental. enjoy with care.#> function (y, mu.hat, ...) #> { #> obj <- 0 #> eps <- .Machine$double.eps * 1e+09 #> for (j in seq(ncol(y))) { #> mu <- mu.hat[, j] #> phi <- 1 #> p <- mu * phi #> q <- (1 - mu) * phi #> p.trans <- tf$math$maximum(p, eps) #> q.trans <- tf$math$maximum(q, eps) #> prob <- tfprobability::tfd_beta(concentration1 = p.trans, #> concentration0 = q.trans) #> obj <- obj + tf$reduce_sum(prob$log_prob(y[, j])) #> } #> -obj #> } #> <bytecode: 0x5578c5dff240> #> <environment: namespace:netReg>inverse.gaussian()$loss#> Warning: family inverse.gaussian is still experimental. enjoy with care.#> function (y, mu.hat, ...) #> { #> obj <- 0 #> for (j in seq(ncol(y))) { #> prob <- tfprobability::tfd_inverse_gaussian(loc = mu.hat[, #> j], concentration = 1) #> obj <- obj + tf$reduce_sum(prob$log_prob(y[, j])) #> } #> -obj #> } #> <bytecode: 0x5578c5e68170> #> <environment: namespace:netReg>