| Home » Topics » General » Weithted analysis in R Goto Forum:
	| 
		
			| Weithted analysis in R [message #29696] | Tue, 23 July 2024 10:22  |  
			| 
				
				
					|  Mahir Messages: 12
 Registered: September 2023
 | Member |  |  |  
	| Dear DHS team, 
 I have one more question regarding analysis of data using sampling weights.
 
 I am  using weighted data for analysis in R. I use r and I am using tbl_svysummary() in R to generate weighted table, how ever after accounting for weight using the following formula I get a weird error
 
 
 library(survey)
 tb1<-svydesign(ids = ~v021,weights = ~wt,data = tb_data, strata = ~v022, nest= T) %>%
 tbl_svysummary(include = c(age,v025,WI),statistic = list(all_continuous() ~"{mean} ({sd})",all_categorical() ~ "{n} ({p}%)"), digits = all_continuous() ~ 2, label = c(age~"Age",v025~"Residence",WI~"Wealth Index"))
 
 I am running this command and I have checked the syntax is ture. However I encounter the following error:
 
 "Warning message:
 There were 2 warnings in `mutate()`.
 The first warning was:
 ℹ In argument: `df_stats = pmap(...)`.
 Caused by warning in `svymean.survey.design2()`:
 ! Sample size greater than population size: are weights correctly scaled?
 
 I am using the DHS_Benin data and I will do the same for seven other counties (Cameroon, Cote d'Ivoire, Ghana, Kenya, liberia, Nigeria and Uganda). Could you help me with this, it would be a big help. I have posted the question on DHS user forum already. Thank you!
 
 Best
 Mahir
 |  
	|  |  | 
 
 Current Time: Fri Oct 31 06:25:38 Coordinated Universal Time 2025 |