Estimates the mean and standard deviation of a latent variable given the discrete probabilities of its observed Likert scale responses.

## Arguments

- prob
named vector of probabilities for each response category.

- n_levels
number of response categories for the Likert scale item.

- skew
marginal skewness of the latent variable, defaults to 0.

- eps
tolerance for convergence, defaults to 1e-6.

- maxit
maximum number of iterations, defaults to 100.

## Details

This function uses an iterative algorithm to solve the system of non-linear equations that describe the relationship between the continuous latent variable and the observed discrete probability distribution of Likert scale responses. The algorithm ensures stability by reparameterizing the system and applying constraints to prevent stepping into invalid regions.

## Examples

```
prob <- c("1" = 0.313, "2" = 0.579, "3" = 0.105, "4" = 0.003)
# returns estimates that are close to the actual mean and sd: c(-1, 0.5)
estimate_mean_and_sd(prob, 5)
#> [1] -1.0025695 0.5004155
```