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
Jeff Newmiller
2016-Dec-03 20:03 UTC
[R] How to setup a multiplicative dummy function in R
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. -- Sent from my phone. Please excuse my brevity. On December 1, 2016 7:22:37 AM PST, lolo koko <lokomiauw at gmail.com> wrote:>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 > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.