regSim              package:fRegression              R Documentation

_R_e_g_r_e_s_s_i_o_n _M_o_d_e_l _S_i_m_u_l_a_t_i_o_n

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

     Simulates regression models.

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

     regSim(model = "LM3", n = 100, ...)

     LM3(n = 100, seed = 4711)
     LOGIT3(n = 100, seed = 4711)
     GAM3(n = 100, seed = 4711)

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

   model: a character string defining the function name from which the
          regression model will be simulated. 

       n: an integer value setting the length, i.e. the number of
          records of the output series, an integer value. By default
          'n=100'. 

    seed: an integer value, the recommended way to specify seeds for 
          random number generation.

     ...: arguments to be passed to the underlying function specified
          by the 'model' argument. 

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

     The function 'regSim' allows to simulate from various regression
     models defined by one of the three example functions 'LM3',
     'LOGIT3', 'GAM3' or by a user specified function.

     The examples are defined in the following way:

     '# LM3:'
      '> y = 0.75 * x1 + 0.25 * x2 - 0.5 * x3 + 0.1 * eps '

     '# LOGIT3:'
      '> y = 1 / (1 + exp(- 0.75 * x1 + 0.25 * x2 - 0.5 * x3 + eps)) '

     '# GAM3:'
      '> y = scale(scale(sin(2 * pi * x1)) + scale(exp(x2)) +
     scale(x3)) '
      '> y = y + 0.1 * rnorm(n, sd = sd(y))'

     '"LM3"' models a liner regression model, '"LOGIT3"' a generalized
     linear regression model expressed by a logit model, and '"GAM"' an
     additive model. 'x1', 'x2', 'x3', and 'eps' are random normal
     deviates of length 'n'.

     The 'model' function should return an rectangular series defined 
     as an object of class 'data.frame', 'timeSeries' or 'mts' which
     can be accepted from the parameter estimation functions 'regFit'
     and 'gregFit'.

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

     The function 'garchSim' returns an object of the same class  as
     returned by the underlying function 'match.fun(model)'. These may
     be objects of class 'data.frame', 'timeSeries' or 'mts'.

_N_o_t_e:

     This function is still under development. For the future we plan, 
     that the function 'regSim' will be able to generate general
     regression models.

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

     Diethelm Wuertz for the Rmetrics R-port.

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

     ## LM2 -
        # Data for a user defined linear regression model:
        LM2 = function(n){
          x = rnorm(n)
          y = rnorm(n)
          eps = 0.1 * rnorm(n)
          z = 0.5 + 0.75 * x + 0.25 * y + eps
          data.frame(Z = z, X = x, Y = y)
        }
        for (FUN in c("LM2", "LM3")) {
          cat(FUN, ":\n", sep = "")
          print(regSim(model = FUN, n = 10))
        }

