`semimrGen' is used to generate data for a two-component semiparametric mixture of regression models: [REMOVE_ME]pm1(x)+(1−p)m2(x),[REMOVEME2]
where m1(x)=4−sin(2πx) and m2(x)=1.5+cos(3π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 x.
p: a scalar, specifying the probability of an observation belonging to the first component, i.e., p in the model.
var: a vector of variances of observations for the two components.
u: a vector of grid points for x. 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) and m2(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) and m2(x) at x.
true_mu_u: length(u) by 2 matrix containing the values of m1(x) and m2(x) at u.
Description
`semimrGen' is used to generate data for a two-component semiparametric mixture of regression models:
pm1(x)+(1−p)m2(x),
where m1(x)=4−sin(2πx) and m2(x)=1.5+cos(3πx).
This function is used in the examples for the semimrLocal and semimrGlobal functions. See the examples for details.
Examples
n =100u = 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)