gspline1 {glmmAK} | R Documentation |
Univariate G-spline (penalized Gaussian mixture) is distributed as
alpha + sum[j=-K][K]w[j]N(tau*mu[j], tau^2*sigma[j]^2).
rgspline1(n, mu, sigma, weight, intcpt=0, scale=1, logw=TRUE) dgspline1(x, mu, sigma, weight, intcpt=0, scale=1, logw=TRUE)
n |
number of observations to be generated |
x |
grid of values at which we evaluate the G-spline values |
mu |
a vector with G-spline knots mu[j] (j=-K,...,K)(means of basis G-splines) |
sigma |
basis standard deviation(s)
sigma[j] (j=-K,...,K).
If a single number is
supplied then it is assumed that all basis G-splines have the same
standard deviation. Alternatively a vector of the same length as
mu can be given in which case the basis G-splines do not
necessarily have the same standard deviations |
weight |
a vector with G-spline (log-)weights. It should have the
same length as mu |
intcpt |
G-spline intercept value alpha) |
scale |
G-spline scale value tau) |
logw |
logical indicating whether logarithmic weights are
supplied in weight |
Values of the density or generated random numbers.
Arnošt Komárek arnost.komarek[AT]mff.cuni.cz
knots <- c(-2, 0, 2) sigma <- 1 weight <- c(0.3, 0.1, 0.6) intcpt <- 3 scale <- 0.2 xgrid <- seq(1.8, 4.2, length=300) dx <- dgspline1(xgrid, mu=knots, sigma=sigma, weight=weight, intcpt=intcpt, scale=scale, logw=FALSE) x <- rgspline1(100, mu=knots, sigma=sigma, weight=weight, intcpt=intcpt, scale=scale, logw=FALSE) hist(x, col="seagreen2", prob=TRUE, xlim=range(xgrid), xlab="x", ylab="g(x)") lines(xgrid, dx, col="red", lwd=2)