% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/remstimate2.R
\name{remstimate}
\alias{remstimate}
\title{remstimate - MLE and HMC estimation for tie-oriented REM}
\usage{
remstimate(
  reh,
  stats,
  method = c("MLE", "HMC"),
  ncores = 1L,
  nsim = 500L,
  nchains = 1L,
  burnin = 500L,
  thin = 10L,
  init = NULL,
  L = 50L,
  epsilon = 0.002,
  prior = NULL,
  seed = NULL,
  WAIC = FALSE,
  nsimWAIC = 100L,
  ...
)
}
\arguments{
\item{reh}{a \code{remify} object.}

\item{stats}{a \code{tomstats} or \code{tomstats_sampled} object (output of
\code{remstats::tomstats()} or \code{remstats::tomstats(sampling=TRUE)}).}

\item{method}{optimization method: \code{"MLE"} (default) or \code{"HMC"}.}

\item{ncores}{number of threads for parallelization (default 1).}

\item{nsim}{[\emph{HMC only}] number of MCMC iterations per chain after burnin. Default 500.}

\item{nchains}{[\emph{HMC only}] number of chains. Default 1.}

\item{burnin}{[\emph{HMC only}] burn-in iterations. Default 500.}

\item{thin}{[\emph{HMC only}] thinning interval. Default 10.}

\item{init}{[\emph{HMC only}] vector of initial parameter values. If NULL,
MLE estimates are used as starting values.}

\item{L}{[\emph{HMC only}] number of leapfrog steps. Default 50.}

\item{epsilon}{[\emph{HMC only}] leapfrog step size. Default 0.002.}

\item{prior}{[\emph{HMC only}] list with elements \code{mean} (prior mean
vector) and \code{vcov} (prior covariance matrix). If NULL, a standard
normal prior is used.}

\item{seed}{[\emph{HMC only}] random seed for reproducibility.}

\item{WAIC}{logical. Compute WAIC? Default FALSE. Only supported for MLE for now.}

\item{nsimWAIC}{number of draws from the (approximate) posterior distribution
used for the computation of the WAIC. Ignored if \code{WAIC = FALSE}.
Default is \code{100L}.}

\item{...}{further arguments (currently unused).}
}
\value{
a \code{remstimate} S3 object.
}
\description{
Estimates tie-oriented relational event model parameters using
Maximum Likelihood Estimation (\code{"MLE"}) or Hamiltonian Monte Carlo
(\code{"HMC"}). Supports both full statistics (\code{tomstats}) and
case-control sampled statistics (\code{tomstats_sampled}).
}
\examples{

# ------------------------------------ #
#       tie-oriented model: "MLE"      #
# ------------------------------------ #

# loading data
data(tie_data)

# processing event sequence with remify
tie_reh <- remify::remify(edgelist = tie_data$edgelist, model = "tie")

# specifying linear predictor
tie_model <- ~ 1 +
               remstats::indegreeSender()+
               remstats::inertia()+
               remstats::reciprocity()

# calculating statistics
tie_reh_stats <- remstats::remstats(reh = tie_reh,
                                    tie_effects = tie_model)

# running estimation
tie_mle <- remstimate::remstimate(reh = tie_reh,
                                  stats = tie_reh_stats,
                                  method = "MLE",
                                  ncores = 1)
# summary
summary(tie_mle)

# ------------------------------------ #
#      actor-oriented model: "MLE"     #
# ------------------------------------ #

# loading data
data(ao_data)

# processing event sequence with remify
ao_reh <- remify::remify(edgelist = ao_data$edgelist, model = "actor")

# specifying linear predictor (for sender rate and receiver choice model)
rate_model <- ~ 1 + remstats::indegreeSender()
choice_model <- ~ remstats::inertia() + remstats::reciprocity()

# calculating statistics
ao_reh_stats <- remstats::remstats(reh = ao_reh,
                                   sender_effects = rate_model,
                                   receiver_effects = choice_model)

# running estimation
ao_mle <- remstimate::remstimate(reh = ao_reh,
                                 stats = ao_reh_stats,
                                 method = "MLE",
                                 ncores = 1)
# summary
summary(ao_mle)

# ------------------------------------ #
#   for more examples check vignettes  #
# ------------------------------------ #

}
