coef.maxlogL | R Documentation |
maxlogL
Fitscoef.maxlogL
is the specific method for the generic function coef
which extracts model coefficients from objects returned by maxlogLreg
.
coefficients
is an alias for coef
.
## S3 method for class 'maxlogL' coef(object, parameter = object$outputs$par_names, ...) coefMany(object, parameter = NULL, ...)
object |
an object of |
parameter |
a character which specifies the parameter is required. In
|
... |
other arguments. |
A named vector with coefficients of the specified distribution parameter.
Jaime Mosquera GutiƩrrez, jmosquerag@unal.edu.co
library(EstimationTools) #-------------------------------------------------------------------------------- # Example 1: coefficients from a model using a simulated normal distribution n <- 1000 x <- runif(n = n, -5, 6) y <- rnorm(n = n, mean = -2 + 3 * x, sd = exp(1 + 0.3* x)) norm_data <- data.frame(y = y, x = x) # It does not matter the order of distribution parameters formulas <- list(sd.fo = ~ x, mean.fo = ~ x) norm_mod <- maxlogLreg(formulas, y_dist = y ~ dnorm, data = norm_data, link = list(over = "sd", fun = "log_link")) coef(norm_mod) coef(norm_mod, parameter = 'sd') a <- coefMany(norm_mod, parameter = c('mean', 'sd')) b <- coefMany(norm_mod) identical(a, b) #-------------------------------------------------------------------------------- # Example 2: Parameters in estimation with one fixed parameter x <- rnorm(n = 10000, mean = 160, sd = 6) theta_1 <- maxlogL(x = x, dist = 'dnorm', control = list(trace = 1), link = list(over = "sd", fun = "log_link"), fixed = list(mean = 160)) coef(theta_1) #--------------------------------------------------------------------------------
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.