gspline1               package:glmmAK               R Documentation

_D_e_n_s_i_t_y _a_n_d _r_a_n_d_o_m _n_u_m_b_e_r _g_e_n_e_r_a_t_i_o_n _f_r_o_m _a _u_n_i_v_a_r_i_a_t_e _G-_s_p_l_i_n_e (_p_e_n_a_l_i_z_e_d _G_a_u_s_s_i_a_n _m_i_x_t_u_r_e)

_D_e_s_c_r_i_p_t_i_o_n:

     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).

_U_s_a_g_e:

     rgspline1(n, mu, sigma, weight, intcpt=0, scale=1, logw=TRUE)

     dgspline1(x, mu, sigma, weight, intcpt=0, scale=1, logw=TRUE)

_A_r_g_u_m_e_n_t_s:

       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'

_V_a_l_u_e:

     Values of the density or generated random numbers.

_A_u_t_h_o_r(_s):

     Arno&#353t Kom&#225rek arnost.komarek[AT]mff.cuni.cz

_E_x_a_m_p_l_e_s:

     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)

