weight data with R Part II

可紊 提交于 2019-12-03 04:42:47

You probably need to get acquainted with the search engines for R. Baron's RSiteSearch and Rseek: This is one of the first hits on "weighted PCA" at Baron's site:

http://finzi.psych.upenn.edu/R/library/aroma.light/html/wpca.matrix.html

With the clarification in the comment to Joris Meys response, the answer is often that one needs to be clear that one is desires sample weights versus other types of weighting. Regression weighting is done with the survey package. Lumley's book on survey methods distinguishes among three types of weights. (The "weights" in the lm function are variance weights, NOT sample weights.)

Note: Both PCA and factor analysis (experimental) are included in the survey package. So maybe Dominick's question requestiong a unified approach to weighting in regression methods has a single "answer".

First of all, doing PCA on this data doesn't make sense. Second, SPSS does not perform PCA but factor analysis, which is something else. I know they call it PCA, but it isn't.

The WEIGHT BY in SPSS is nothing more than a replication weight, and is exactly the same as doing your analysis by repeating your cases using rep(): complete madness. To link to your example: In SPSS, FACTOR (which is used for the socalled PCA) does not take fractional weights.

If you want to perform weighted procedures, the only sensible way of doing that is using the correct method/function/package for that. In statistics, there is no one-size-fits-all weight procedure, contrary to what SPSS likes to make you believe.

In your example : weighted PCA in R is contained in FactoMineR and aroma.light. But I strongly suggest you take also a look at the vegan package, as that contains a lot more useful ordination methods for the data you're describing.

I am not sure if this would suite you. See the R package weights.

I have just found a Post in R-Bloggers which introduces a svydesign() function. As far as I know, this function from the Survey Package is like SPSS function, allow you to create a weighted data to use in further analysis. I find it more useful than using different functions from several packages in order to do multivariable analysis. Hope you find useful!

Another social science analyst using R ;)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!