semimrGen {MixSemiRob} | R Documentation |
Semiparametric Mixture Data Generator
Description
‘semimrGen’ is used to generate data for a two-component semiparametric mixture of regression models:
p m_1(x) + (1-p) m_2(x),
where m_1(x) = 4 -\sin(2\pi x)
and 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.
Usage
semimrGen(n, p = 0.5, var = c(.1, .1), u)
Arguments
n |
a scalar, specifying the number of observations in |
p |
a scalar, specifying the probability of an observation belonging to the first component,
i.e., |
var |
a vector of variances of observations for the two components. |
u |
a vector of grid points for |
Value
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 |
true_mu |
n by 2 matrix containing the values of |
true_mu_u |
length(u) by 2 matrix containing the values of |
See Also
semimrLocal
, semimrGlobal
, semimrBinFull
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)