Description Usage Arguments Examples
function to fit a cub model. The user could use covariates or not to model the parameters pi and xi.
1 2 3 4 5 6 7 8 9 10 11 12 |
pi.fo |
an object of class |
xi.fo |
an object of class |
m |
the maximum value of the response variable. |
data |
an optional data frame. |
subset |
an optional vector specifying a subset of observations to be used. For example, |
optimizer |
two options are available: |
pi.link |
link function to use for model pi parameter, two options are available, logit or probit, by default is probit. |
xi.link |
link function to use for model xi parameter, two options are available, logit or probit, by default is probit. |
initial.values |
vector with the initial values to the searching procedure to nlminb and optim optimizers. |
... |
Further arguments to be passed to |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # Example 1 ---------------------------------------------------------------
# Generating a random sample given the values of pi and xi
set.seed(2019)
y <- rcub(n=100, pi=0.15, xi=0.60, m=5)
mod1 <- cub(pi.fo=y ~ 1, xi.fo=~ 1, m=5,
pi.link='probit', xi.link='probit',
optimizer='nlminb')
summary(mod1)
# estimations for pi and xi
pnorm(mod1$par[1])
pnorm(mod1$par[2])
# Example 2 ---------------------------------------------------------------
# Generating a random sample given the values of pi and xi
# estimation using logit link function
set.seed(2019)
y <- rcub(n=100, pi=0.15, xi=0.60, m=5)
mod2 <- cub(pi.fo=y ~ 1, xi.fo=~ 1, m=5,
pi.link='logit', xi.link='logit',
optimizer='nlminb')
summary(mod2)
# estimations for pi and xi
boot::inv.logit(mod2$par[1])
boot::inv.logit(mod2$par[2])
# Example 3 ---------------------------------------------------------------
# Generating a random sample given the values of pi and xi
# estimation using logit and probit as link function
set.seed(2019)
y <- rcub(n=100, pi=0.15, xi=0.60, m=5)
mod3 <- cub(pi.fo=y ~ 1, xi.fo=~ 1, m=5,
pi.link='logit', xi.link='probit',
optimizer='nlminb')
summary(mod3)
# estimations for pi and xi
boot::inv.logit(mod3$par[1])
pnorm(mod3$par[2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.