[R-SIG-Finance] Fwd: Using dummy variables R
markleeds at verizon.net
markleeds at verizon.net
Thu Feb 12 19:36:37 CET 2009
hi: suppose you had just sectors so it was a one way anova : then if you
make the sectors factors rather than dummies, then, the default
contrasts for R are contr.sum and this means that your design matrix
will automatically make one of your dummies the average response
and in this way get rid of the implicit multicollinearity in the design
matrix.
john fox's text and car book get into this topic in more detail. I have
found it complicated and, since you have a two way anova, it's even more
complicated. but the key thing to do is change your dummies to factors
and let R do the work of making the design matrix full rank.
Also, I would send your question to R-help because there are people over
there ( who may not be on R-Sig-Finance ) who can say a lot about your
problem.
Mark
On Thu, Feb 12, 2009 at 12:26 PM, P vanzweden wrote:
> Dear R-helpers,
>
>
>
> I have the following model: Return ~ intercept+ EU + AUS + ASIA + USA
> +
> office +
> retail + industrial + residential.
>
> The model consist of an intercept ,region- and sector - dummies.
>
>
>
> When including all the dummies and the intercept, I will be caught in
> a so
> called "dummy variable trap". This problem is a perfect
> multicollinearity;
> because the regression is not solvable since the X matrix is not fully
> ranked.
>
>
>
> To estimate the model that includes all dummies variables and the
> intercept,
> I need to imposes two restriction that the sum of the region
> parameters is
> zero and the sum of the sector parameters is zero.
>
>
>
> How can I estimate this restricted linear regression model in R?
>
>
> Is this possible to do this in the lm framework?
>
> Thanks in advance,
>
> Peter
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
More information about the R-SIG-Finance
mailing list