# NOT RUN {
#--------------------------------------------------------------------------------
### First example: One known 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))
summary(theta_1)
#--------------------------------------------------------------------------------
# Second example: Binomial probability parameter estimation with variable
# creation
N <- rbinom(n = 100, size = 10, prob = 0.3)
phat <- maxlogL(x = N, dist = 'dbinom', fixed = list(size = 10),
link = list(over = "prob", fun = "logit_link"))
## Standard error calculation method
print(phat$outputs$StdE_Method)
## Standard error value (not computed yet, because is computed with 'summary')
print(phat$outputs$StdE)
## 'summary' method
summary(phat)
## Now, standard error is updated
print(phat$outputs$StdE_Method)
print(phat$outputs$StdE)
#--------------------------------------------------------------------------------
# Third example: Binomial probability parameter estimation with no varaible
# creation
N <- rbinom(n = 100, size = 10, prob = 0.3)
summary(maxlogL(x = N, dist = 'dbinom', fixed = list(size = 10),
link = list(over = "prob", fun = "logit_link")))
#--------------------------------------------------------------------------------
# }
Run the code above in your browser using DataLab