search for: popweight

Displaying 2 results from an estimated 2 matches for "popweight".

2009 Jun 23
2
Weighting column entries in a data frame
...9600 544.00 ALASKA 2 3 10.101300 539.00 I would like to adjust "income" by population ("popul") for each state. I can use: statepop<-tapply(fdata$popul,fdata$state,sum), which gives: ALABAMA ALASKA 53590.130 7435.263 I can find the weights: popweight <- statepops/sum(statepops) ALABAMA ALASKA 0.016327564 0.002265338 Is there an efficient way to multiply each entry of "income" by "popweght" conditional on the state? That is, ALABAMA income for year 1 is 9.703193*0.016327564, etc. Thanks, William -- V...
2005 Aug 26
1
Help in Compliling user -defined functions in Rpart
...abs(rci)*(1-abs(rci)) goodness<-devci-0.5*(lw/sum(wt))*devlci-0.5*(rw/sum(wt))*devrci list(goodness=goodness, direction=sign(lci)) } } alist<-list(eval=temp.eval,split=temp.split,init=temp.init) tree<-rpart(u~pcares+antcare.skilled+riskintb+child.born+married+mage1+mage2, weights=popweight,method=alist)