Skip to content

How to setup a multiplicative dummy function in R

2 messages · lolo koko, Jeff Newmiller

#
Hello?

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,

Peter
2 days later
#
I think you need an offset term, or maybe I just don't understand your question.  A sample data set, particularly if you can show us how your equation could be used to generate the sample data, would be helpful.