WALD | R Documentation |
The function WALD()
defines the wALD distribution, two-parameter
continuous distribution for a gamlss.family
object to be used in GAMLSS fitting
using the function gamlss()
.
WALD(mu.link = "log", sigma.link = "log")
mu.link |
defines the mu.link, with "log" link as the default for the mu parameter. |
sigma.link |
defines the sigma.link, with "log" link as the default for the sigma parameter. |
The Wald distribution with parameters \mu
and sigma
has density given by
\operatorname{f}(x |\mu, \sigma)=\frac{\sigma}{\sqrt{2 \pi x^3}} \exp \left[-\frac{(\sigma-\mu x)^2}{2x}\right ], x>0
Returns a gamlss.family object which can be used to fit a WALD distribution in the gamlss()
function.
Sofia Cuartas GarcĂa, scuartasg@unal.edu.co
Heathcote, A. (2004). Fitting Wald and ex-Wald distributions to response time data: An example using functions for the S-PLUS package. Behavior Research Methods, Instruments, & Computers, 36, 678-694.
dWALD.
# Example 1
# Generating random values with
# known mu and sigma
require(gamlss)
mu <- 1.5
sigma <- 4.0
y <- rWALD(10000, mu, sigma)
mod1 <- gamlss(y~1, sigma.fo=~1, family="WALD",
control=gamlss.control(n.cyc=5000, trace=TRUE))
exp(coef(mod1, what="mu"))
exp(coef(mod1, what="sigma"))
# Example 2
# Generating random values under some model
# A function to simulate a data set with Y ~ WALD
gendat <- function(n) {
x1 <- runif(n)
x2 <- runif(n)
mu <- exp(0.75 - 0.69 * x1) # Approx 1.5
sigma <- exp(0.5 - 0.64 * x2) # Approx 1.20
y <- rWALD(n, mu, sigma)
data.frame(y=y, x1=x1, x2=x2)
}
dat <- gendat(n=200)
mod2 <- gamlss(y~x1, sigma.fo=~x2, family=WALD, data=dat,
control=gamlss.control(n.cyc=5000, trace=TRUE))
summary(mod2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.