fnormal1                package:VGAM                R Documentation

_F_o_l_d_e_d _N_o_r_m_a_l _D_i_s_t_r_i_b_u_t_i_o_n _F_a_m_i_l_y _F_u_n_c_t_i_o_n

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

     Fits a (generalized) folded (univariate) normal distribution.

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

     fnormal1(lmean="identity", lsd="loge", emean=list(), esd=list(),
              imean=NULL, isd=NULL, a1=1, a2=1, nsimEIM=500,
              method.init=1, zero=NULL)

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

     See 'CommonVGAMffArguments' for general information about many of
     these arguments.

lmean, lsd: Link functions for the mean and standard deviation
          parameters of the usual univariate normal distribution. They
          are mu and sigma respectively. See 'Links' for more choices.

emean, esd: List. Extra argument for each of the links. See 'earg' in
          'Links' for general information.

imean, isd: Optional initial values for mu and sigma. A 'NULL' means a
          value is computed internally.

  a1, a2: Positive weights, called a1 and a2 below. Each must be of
          length 1.

nsimEIM, method.init, zero: See 'CommonVGAMffArguments'.

_D_e_t_a_i_l_s:

     If a random variable has an ordinary univariate normal
     distribution then the absolute value of that random variable has
     an ordinary _folded normal distribution_. That is, the sign has
     not been recorded; only the magnitude has been measured.

     More generally, suppose X is normal with mean 'mean' and standard
     deviation 'sd'. Let Y=max(a1*X, -a2*X) where a1 and a2 are
     positive weights. This means that Y = a1*X for X > 0, and Y = a2*X
     for X < 0. Then Y is said to have a _generalized folded normal
     distribution_. The ordinary folded normal distribution corresponds
     to the special case a1 = a2 = 1.

     The probability density function of the ordinary folded normal
     distribution can be written 'dnorm(y, mean, sd) + dnorm(y, -mean,
     sd)' for y >= 0. By default, 'mean' and 'log(sd)' are the
     linear/additive predictors. Having 'mean=0' and 'sd=1' results in
     the _half-normal_ distribution. The mean of an ordinary folded
     normal distribution is

 E(Y) = sigma*sqrt(2/pi)*exp(-mu^2/(2*sigma^2)) + mu*[1-2*Phi(-mu/sigma)]

     and these are returned as the fitted values. Here, Phi is the
     cumulative distribution function of a standard normal ('pnorm').

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

     An object of class '"vglmff"' (see 'vglmff-class'). The object is
     used by modelling functions such as 'vglm' and 'vgam'.

_W_a_r_n_i_n_g:

     Under- or over-flow may occur if the data is ill-conditioned. It
     is recommended that several different initial values be used to
     help avoid local solutions.

_N_o_t_e:

     The response variable for this family function is the same as
     'normal1' except positive values are required. Reasonably good
     initial values are needed. Fisher scoring using simulation is
     implemented.

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

     Thomas W. Yee

_R_e_f_e_r_e_n_c_e_s:

     Lin, P. C. (2005) Application of the generalized folded-normal
     distribution to the process capability measures. _International
     Journal of Advanced Manufacturing Technology_, *26*, 825-830.

_S_e_e _A_l_s_o:

     'rfnorm', 'normal1', 'dnorm', 'skewnormal1'.

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

     m =  2; SD = exp(1)
     y = rfnorm(n <- 1000, m=m, sd=SD)
     ## Not run: hist(y, prob=TRUE, main=paste("fnormal1(m=",m,", sd=",round(SD,2),")"))
     fit = vglm(y ~ 1, fam=fnormal1, trace=TRUE)
     coef(fit, mat=TRUE)
     (Cfit = Coef(fit))
     mygrid = seq(min(y), max(y), len=200) # Add the fit to the histogram
     ## Not run: lines(mygrid, dfnorm(mygrid, Cfit[1], Cfit[2]), col="red")

