Displaying 6 results from an estimated 6 matches for "zdiversity_pa".
2017 May 05
6
lm() gives different results to lm.ridge() and SPSS
Hi,
Here is (I hope) all the relevant output from R.
> mean(s1$ZDEPRESSION, na.rm=T) [1] -1.041546e-16 > mean(s1$ZDIVERSITY_PA, na.rm=T) [1] -9.660583e-16 > mean(s1$ZMEAN_PA, na.rm=T) [1] -5.430282e-15 > lm.ridge(ZDEPRESSION ~ ZMEAN_PA * ZDIVERSITY_PA, data=s1)$coef ZMEAN_PA ZDIVERSITY_PA ZMEAN_PA:ZDIVERSITY_PA
-0.3962254 -0.3636026 -0.1425772 ## This is what I thoug...
2017 May 05
1
lm() gives different results to lm.ridge() and SPSS
Thanks, I was getting to try this, but got side tracked by actual work...
Your analysis reproduces the SPSS unscaled estimates. It still remains to figure out how Nick got
>
coefficients(lm(ZDEPRESSION ~ ZMEAN_PA * ZDIVERSITY_PA, data=s1))
(Intercept) ZMEAN_PA ZDIVERSITY_PA ZMEAN_PA:ZDIVERSITY_PA
0.07342198 -0.39650356 -0.36569488 -0.09435788
which does not match your output. I suspect that ZMEAN_PA and ZDIVERSITY_PA were scaled for this an...
2017 May 05
1
lm() gives different results to lm.ridge() and SPSS
...dge() and SPSS
Dear Nick,
On 2017-05-05, 9:40 AM, "R-devel on behalf of Nick Brown"
<r-devel-bounces at r-project.org on behalf of nick.brown at free.fr> wrote:
>>I conjecture that something in the vicinity of
>> res <- lm(DEPRESSION ~ scale(ZMEAN_PA) + scale(ZDIVERSITY_PA) +
>>scale(ZMEAN_PA * ZDIVERSITY_PA), data=dat)
>>summary(res)
>> would reproduce the SPSS Beta values.
>
>Yes, that works. Thanks!
That you have to work hard in R to match the SPSS results isn?t such a bad
thing when you factor in the observation that standardizing...
2017 May 05
0
lm() gives different results to lm.ridge() and SPSS
Dear Nick,
On 2017-05-05, 9:40 AM, "R-devel on behalf of Nick Brown"
<r-devel-bounces at r-project.org on behalf of nick.brown at free.fr> wrote:
>>I conjecture that something in the vicinity of
>> res <- lm(DEPRESSION ~ scale(ZMEAN_PA) + scale(ZDIVERSITY_PA) +
>>scale(ZMEAN_PA * ZDIVERSITY_PA), data=dat)
>>summary(res)
>> would reproduce the SPSS Beta values.
>
>Yes, that works. Thanks!
That you have to work hard in R to match the SPSS results isn?t such a bad
thing when you factor in the observation that standardizing the
in...
2017 May 05
0
lm() gives different results to lm.ridge() and SPSS
I had no problems running regression models in SPSS and R that yielded the same results for these data.
The difference you are observing is from fitting different models. In R, you fitted:
res <- lm(DEPRESSION ~ ZMEAN_PA * ZDIVERSITY_PA, data=dat)
summary(res)
The interaction term is the product of ZMEAN_PA and ZDIVERSITY_PA. This is not a standardized variable itself and not the same as "ZINTER_PA_C" in the png you showed, which is not a variable in the dataset, but can be created with:
dat$ZINTER_PA_C <- with(dat,...
2017 May 04
2
lm() gives different results to lm.ridge() and SPSS
Hi Simon,
Yes, if I uses coefficients() I get the same results for lm() and lm.ridge(). So that's consistent, at least.
Interestingly, the "wrong" number I get from lm.ridge()$coef agrees with the value from SPSS to 5dp, which is an interesting coincidence if these numbers have no particular external meaning in lm.ridge().
Kind regards,
Nick
----- Original Message -----