[R-sig-Geo] dummies and multicollinearity in lagsarlm

Roger Bivand Roger.Bivand at nhh.no
Thu Dec 18 20:02:40 CET 2008


On Thu, 18 Dec 2008, Annachiara Saguatti wrote:

> Since I want to obtain a common spatial autoregressive parameter (rho) is it
> correct to estimate
>
>> lagsarlm(formula= y ~ D1 / (x1+x2+x3) + D2 / (x1+x2+x3) - 1, data=...,
> listw=...)
>
> where D1 and D2 are two complementary dummies?
> Estimating a model with just one of the two returns me the coefficient for
> only one of the two groups of regions, right?

Please read up on factors and formula objects - I suggest Ch 4 of John 
Fox' An R and S-Plus Companion to Applied Regression (Sage, 2002). When 
you have grasped what is going on, try:

D1D2 <- factor(D1+(2*D2))
# maybe with labels= to provide something more informative than just 1 and 2

and

y ~ D1D2 / ...

Hope this helps,

Roger

>
> Thanks,
> Annachiara
>
>
> 2008/12/18 Roger Bivand <Roger.Bivand at nhh.no>
>
>> On Thu, 18 Dec 2008, Annachiara Saguatti wrote:
>>
>>  Hello,
>>>
>>> is there a way to estimate a sar model (> lagsarlm) with a dummy variable
>>> in
>>> order to discriminate into two spatial regimes and obtain two different
>>> coefficients' estimations for each variable? So far I've been constructing
>>> two new variables from each original one by multiplicating it by each
>>> dummy,
>>> that is: GPC*D1 and GDP*D2. After that I've been running a regression by
>>> using the two new variables as explanatory v.
>>> Since the two dummies are perfecly complementary, I guess there might be a
>>> problem of multicollinearity in this way of estimating the model. Is there
>>> an option like the "subset" one in the "lm" function which I can use in a
>>> SAR model? Or otherwise, how would you estimate a SAR model with two
>>> spatial
>>> regimes in R?
>>>
>>
>> This is one of the strengths of the formula abstraction. Dummies are not
>> needed, just a factor. The notation would be something like:
>>
>> formula=y ~ factor / (x1 + x2 + x3 + ...) - 1, data=...
>>
>> with / using the factor to fit coefficients of the xi for each level of
>> factor, and -1 removing a global intercept, so giving an intercept for each
>> level of factor. The Chow test is then anova() of the model without factor /
>> ... -1 against the model with it.
>>
>> Hope this helps,
>>
>> Roger
>>
>>
>>
>>> Thank you
>>> Annachiara Saguatti
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>> --
>> Roger Bivand
>> Economic Geography Section, Department of Economics, Norwegian School of
>> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
>> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
>> e-mail: Roger.Bivand at nhh.no
>>
>>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list