Calculate a censored mean
mean_tobit.Rd
Calculate a censored mean
Usage
mean_tobit(
x,
lower = -Inf,
upper = Inf,
include_equal = TRUE,
include_equal_lower = include_equal,
include_equal_upper = include_equal,
distribution,
na.rm = TRUE,
...
)
Arguments
- x
A numeric vector
- lower, upper
The lower and upper bounds for censoring
x
- include_equal, include_equal_lower, include_equal_upper
Should the bounds consider
x <= lower
andx >= upper
(ifTRUE
) orx < lower
andx > upper
(ifFALSE
) to be censored? (include_equal
is overridden by settinginclude_equal_lower
orinclude_equal_upper
.)- distribution
What distribution (Student "t" or "normal") should be used. If "t", the degrees of freedom are the number of non-
NA
values inx
.- na.rm
A logical value indicating whether
NA
values should be stripped fromx
before the computation proceeds.- ...
Arguments passed on to
stats::optim
par
Initial values for the parameters to be optimized over.
fn
A function to be minimized (or maximized), with first argument the vector of parameters over which minimization is to take place. It should return a scalar result.
gr
A function to return the gradient for the
"BFGS"
,"CG"
and"L-BFGS-B"
methods. If it isNULL
, a finite-difference approximation will be used.For the
"SANN"
method it specifies a function to generate a new candidate point. If it isNULL
a default Gaussian Markov kernel is used.method
The method to be used. See ‘Details’. Can be abbreviated.
lower,upper
Bounds on the variables for the
"L-BFGS-B"
method, or bounds in which to search for method"Brent"
.control
a
list
of control parameters. See ‘Details’.hessian
Logical. Should a numerically differentiated Hessian matrix be returned?
Value
A 'mean_tobit' object which is a number with attributes for the standard deviation (sd) and convergence information in the "message" attribute.
See also
Other Censored Descriptive Statistics:
geomean_tobit()
,
sd_tobit()