fpiter | R Documentation |
A function to implement the fixed-point iteration algorithm. This includes monotone, contraction mappings including EM and MM algorithms
fpiter(par, fixptfn, objfn=NULL, control=list( ), ...)
par |
A vector of parameters denoting the initial guess for the fixed-point iteration. |
fixptfn |
A vector function, F that denotes the fixed-point mapping. This function is the most essential input in the package. It should accept a parameter vector as input and should return a parameter vector of same length. This function defines the fixed-point iteration: x[k+1] = F(x[k]. In the case of EM algorithm, F defines a single E and M step. |
objfn |
This is a scalar function, $L$, that denotes a ”merit”
function which attains its local minimum at the fixed-point of $F$.
This function should accept a parameter vector as input and should
return a scalar value. In the EM algorithm, the merit function L
is the log-likelihood. In some problems, a natural merit function may
not exist, in which case the algorithm works with only |
control |
A list of control parameters to pass on to the algorithm. Full names of control list elements must be specified, otherwise, user-specifications are ignored. See *Details* below. |
... |
Arguments passed to |
control
is list of control parameters for the algorithm.
control = list(tol = 1.e-07, maxiter = 1500, trace = FALSE)
tol
A small, positive scalar that determines when iterations
should be terminated. Iteration is terminated when
abs(x[k] - F(x[k]) <= tol.
Default is 1.e-07
.
maxiter
An integer denoting the maximum limit on the number of
evaluations of fixptfn
, F. Default is 1500
.
trace
A logical variable denoting whether some of the intermediate
results of iterations should be displayed to the user.
Default is FALSE
.
A list with the following components:
par |
Parameter,x* that are the fixed-point of F such that x* = F(x*), if convergence is successful. |
value.objfn |
The value of the objective function L at termination. |
fpevals |
Number of times the fixed-point function |
objfevals |
Number of times the objective function |
convergence |
An integer code indicating type of convergence.
|
daarem
### Generate outcomes from a probit regression model n <- 1000 npars <- 5 true.beta <- .5*rt(npars, df=2) + 1 XX <- matrix(rnorm(n*npars), nrow=n, ncol=npars) yy <- ProbitSimulate(true.beta, XX) max.iter <- 1000 beta.init <- rep(0.0, npars) ### EM algorithm for estimating parameters from probit regression em.probit <- fpiter(par=beta.init, fixptfn = ProbitUpdate, X=XX, y=yy, control=list(maxiter=max.iter))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.