semimrGen function

Semiparametric Mixture Data Generator

Semiparametric Mixture Data Generator

`semimrGen' is used to generate data for a two-component semiparametric mixture of regression models: [REMOVE_ME]pm1(x)+(1p)m2(x),[REMOVEME2] p m_1(x) + (1-p) m_2(x), [REMOVE_ME_2]

where m1(x)=4sin(2πx)m_1(x) = 4 -\sin(2\pi x) and m2(x)=1.5+cos(3πx).m_2(x) = 1.5 + \cos(3\pi x).

This function is used in the examples for the semimrLocal and semimrGlobal functions. See the examples for details.

semimrGen(n, p = 0.5, var = c(.1, .1), u)

Arguments

  • n: a scalar, specifying the number of observations in xx.
  • p: a scalar, specifying the probability of an observation belonging to the first component, i.e., pp in the model.
  • var: a vector of variances of observations for the two components.
  • u: a vector of grid points for xx. If some specific explanatory variable are needed, create a vector and assign to u.

Returns

A list containing the following elements: - x: vector of length n, which represents the explanatory variable that is randomly generated from Uniform(0,1).

  • y: vector of length n, which represent the response variable that is generated based on the mean functions m1(x)m_1(x) and m2(x)m_2(x), with the addition of normal errors having a mean of 0 and a standard deviation specified by the user.

  • true_mu: n by 2 matrix containing the values of m1(x)m_1(x) and m2(x)m_2(x) at x.

  • true_mu_u: length(u) by 2 matrix containing the values of m1(x)m_1(x) and m2(x)m_2(x) at u.

Description

`semimrGen' is used to generate data for a two-component semiparametric mixture of regression models:

pm1(x)+(1p)m2(x), p m_1(x) + (1-p) m_2(x),

where m1(x)=4sin(2πx)m_1(x) = 4 -\sin(2\pi x) and m2(x)=1.5+cos(3πx).m_2(x) = 1.5 + \cos(3\pi x).

This function is used in the examples for the semimrLocal and semimrGlobal functions. See the examples for details.

Examples

n = 100 u = seq(from = 0, to = 1, length = 100) true_p = c(0.3, 0.7) true_var = c(0.09, 0.16) out = semimrGen(n = n, p = true_p[1], var = true_var, u = u)

See Also

semimrLocal, semimrGlobal, semimrBinFull

  • Maintainer: Suyeon Kang
  • License: GPL (>= 2)
  • Last published: 2023-09-20

Useful links