[R] How to setup a multiplicative dummy function in R

lolo koko lokomiauw at gmail.com
Thu Dec 1 16:22:37 CET 2016


Does anyone know how I can implement the below equation in R? I would
like to estimate the following equation:

  y=beta_ij * (1+gamma_j * dummy) * x_ij

where y is continuous, and all the x variables (j of them) are i=3
level categorical variables. The intuition is that instead of
estimating the additive value for a dummy variable, I would like to
estimate the multiplicative value for the dummy variable. Thus the
presence of the dummy would scale the beta. Note that for each x
variable there is only one gamma.

For concreteness, you can imagine that y is a continious test score, x
are categorical variables indicating different types of education
achievements, each type of education achievement is categorised in 3
levels (none, some, a lot), and the dummy indicates race. In this
model I believe that race affects test scores proportionally to
estimated beta of each education level. This avoids having to estimate
a gamma for each education achievement level.

Is the solution to simply use nls {stats} and type out the equation?

Hope the explanation makes sense, happy to explain further.

Best wishes,


More information about the R-help mailing list