Relative Content

Tag Archive for rfunctionsurveyvarianceestimation

i’m having a problem using Survey package in R, i coded a prop an cv function but its returning different results for the same svytotal results

library(survey) wrap.table3 = function(SVYres, Niv1, Niv2, Niv3) { Tabela = array(SVYres, dim = c(length(Niv1), length(Niv2), length(Niv3))) TabCV = array(cv(SVYres), dim = c(length(Niv1), length(Niv2), length(Niv3))) dimnames(Tabela) = dimnames(TabCV) = list(Niv1, Niv2, Niv3) Total12 = apply(Tabela, c(1, 2), sum) TabProp12 = Total12 for(i in 1:nrow(TabProp12)){ TabProp12[i,] = TabProp12[i,] / sum(TabProp12[i,]) } TabProp12 = TabProp12 * 100 Total13 […]