Is there a way to type in a regression formula in SPSS in the same manner as R, with weights?
For example, in R, I would write something like:
lm(y ~ B1 + B2 + B1*B2, data=df, weights=x)
How would I go about recreating this in SPSS/PASW?
In recent versions of SPSS you can run R code directly in SPSS on your SPSS datasets.
In SPSS you can have the GUI write the syntax for you via the paste button. If you go through the regression command in the window there is an option to include weights.
Here is some sample code it just had the program output for me:
As with any program, I would suggest you check the documentation on how SPSS implements weights in OLS (I personally have no idea).
A comment by Wolfgang below points out that R and SPSS implement weights in the same manner (although I would still suggest checking out the documentation of how they implement weights.)
1) You can always find out exactly how an algorithm in SPSS is defined mathematically from the Algorithms link on the Help menu.
2) SPSS also has a Weighted Least Square procedure that allows you to model the error variance and correct for heteroscedasticity.
2) In order to run R within SPSS (version 16 or later), you just need to install the R plugin or Essentials (depending on version) from SPSS Developer Central, www.spss.com/devcentral. The integration is free. You can also get SPSS syntax and dialog boxes for a number of useful R packages from the same site.