estimate_mean_and_sd | R Documentation |
Estimates the mean and standard deviation of a latent variable given the discrete probabilities of its observed Likert scale responses.
estimate_mean_and_sd(prob, n_levels, skew = 0, eps = 1e-06, maxit = 100)
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. |
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.
A numeric vector with two elements: the estimated mean and standard deviation.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.