optimParams | R Documentation |
Wrapper function for OptimParams class
optimParams(X, Y, K, link = c("logit", "probit"), M = NULL, nc = 0)
X |
Data matrix of covariables |
Y |
Output as a binary vector |
K |
Number of populations. |
link |
The link type, 'logit' or 'probit'. |
M |
the empirical cross-moments between X and Y (optional) |
nc |
Number of cores (default: 0 to use all) |
An object 'op' of class OptimParams, initialized so that
op$run(theta0)
outputs the list of optimized parameters
p: proportions, size K
beta: regression matrix, size dxK
b: intercepts, size K
theta0 is a list containing the initial parameters. Only beta is required (p would be set to (1/K,...,1/K) and b to (0,...0)).
multiRun
to estimate statistics based on beta, and
generateSampleIO
for I/O random generation.
# Optimize parameters from estimated mu io <- generateSampleIO(100, 1/2, matrix(c(1,-2,3,1),ncol=2), c(0,0), "logit") mu <- computeMu(io$X, io$Y, list(K=2)) o <- optimParams(io$X, io$Y, 2, "logit") ## Not run: theta0 <- list(p=1/2, beta=mu, b=c(0,0)) par0 <- o$run(theta0) # Compare with another starting point theta1 <- list(p=1/2, beta=2*mu, b=c(0,0)) par1 <- o$run(theta1) # Look at the function values at par0 and par1: o$f( o$linArgs(par0) ) o$f( o$linArgs(par1) ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.