Brazil’s household ICT survey in Python: every published cell of three indicators reproduced from the producer’s bootstrap replicate weights, then a design-based look at why rural households are less connected.
ImportantThis case study starts with Thiago Meireles
In April 2026, Thiago Meireles (Cetic.br|NIC.br), who works at the survey’s producer, published the first independent comparison of svy against R’s survey package on this file. He matched the two libraries once their bootstrap scale conventions were aligned, and documented the producer’s scale that every analysis of this file needs.
Everything below builds on his work: his R results are the reference for the standard errors, and his write-up is where the scale convention was first made explicit.
TIC Domicílios is Brazil’s household survey of information and communication technologies. Its public file carries a final weight and 200 bootstrap replicate weights, and no strata or primary sampling units.
The published tables, reproduced. With the producer’s bootstrap scale and its base for percentages, 63 of 63 published cells of three household indicators match after rounding, and Thiago Meireles’ R standard errors match to six decimals.
The rural gap, explained. Rural households are 6.1 points less likely to have Internet access. Adjusting for region, family income and the schooling of the head of household brings the gap to +0.4 points (95% confidence interval -1.3 to 2.0).
Not social class. The Brazilian class criterion counts a computer among its goods, so it partly measures the outcome; it also separates the outcome in replicate refits, and the model loses its standard errors.
Background
TIC Domicílios is run every year by Cetic.br, a research center of the Brazilian Network Information Center (NIC.br), to measure access to and use of information and communication technologies (ICT; TIC in Portuguese) in Brazilian households. The microdata are public under a CC BY 4.0 license.
The 2025 design is new, built on the 2022 Census frame (methodology report, in Portuguese). Census tracts are grouped into primary sampling units (PSUs) of at least 60 households, stratified in three steps (geography, urban or rural situation, and a socioeconomic proxy) into 378 strata. 2,070 PSUs are drawn with probability proportional to size, then tracts, then households. The weights are adjusted for nonresponse and calibrated to the national continuous household survey (PNAD Contínua); the 200 replicates are calibrated the same way.
This page uses the household file. The weighting is the producer’s and is used as delivered.
The file you actually get
The household file is an SPSS file with Portuguese variable and value labels. One call reads the data and both sets of labels:
View code
raw = svy.io.create_from_spss(DATA, normalize_names=True)print(f"{raw.data.height:,} households, {raw.data.width} variables")print(raw.meta.var_labels["a4"])print(raw.meta.value_labels["a4"])
27,177 households, 271 variables
Este domicílio tem acesso à Internet?
{'0': 'Não', '1': 'Sim', '97': 'Não sabe', '98': 'Não respondeu'}
normalize_names=True gives lowercase names; without it, svy keeps the SPSS names as written (PESO, A4). Three things in the file shape everything after:
Sentinel codes. Questions carry 97Não sabe (don’t know), 98Não respondeu (no answer) and 99Não se aplica (not applicable) as ordinary values. Keep them until you know what the published base does with them.
A weight and 200 replicates. The final weight is peso; the replicate weights are rep1 to rep200.
No design columns. The file carries no strata and no PSUs, so Taylor linearization is not available. Every standard error comes from the replicates.
The design: the producer’s scale
A bootstrap variance is a scaled sum of squared deviations of the replicate estimates. The scale depends on how the replicates were built, and Cetic.br publishes its own: 0.0065365334145709, which is the value its R replicate design carries. Pass it to svy.RepWeights:
Leave scale= out and svy uses its default bootstrap scale. The estimates do not change, but the standard errors come out 12.5% too small: for households with Internet access, 0.356 points instead of 0.407.
Reproducing the published tables
Cetic.br publishes its indicators as web tables of whole percentages. Indicator A4 is the share of households with Internet access, by area:
View code
est = tic.estimation.prop(y="a4", by="area", method="replication")print(est)
╭───────────────────────────────── Estimate: PROP (BOOTSTRAP) ──────────────────────────────────╮│││Área Este domicílio tem acesso à Internet? est se lci uci cv (%)││ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ││ URBANA Não 0.1285 0.0045 0.1198 0.1376 3.51 ││ URBANA Sim 0.8699 0.0046 0.8606 0.8787 0.53 ││ URBANA Não sabe 0.0015 0.0004 0.0008 0.0025 28.19 ││ URBANA Não respondeu 0.0002 0.0001 0.0001 0.0005 56.62 ││ RURAL Não 0.1890 0.0086 0.1726 0.2065 4.54 ││ RURAL Sim 0.8092 0.0086 0.7916 0.8256 1.07 ││ RURAL Não sabe 0.0019 0.0009 0.0007 0.0047 47.59 ││ RURAL Não respondeu 0.0000 0.0000 0.0000 0.0002 105.51 │││╰───────────────────────────────────────────────────────────────────────────────────────────────╯
Sim (yes) is 87.0% in urban areas and 80.9% in rural areas; the published table gives 87 and 81. Não sabe and Não respondeu appear in the table: they are small, and they stay in the denominator.
The base is all households
That last point is the one convention to get right. The published percentages are of all households, so don’t-know and no-answer count in the base. Dropping them gives a slightly different denominator, and the rounding no longer lands on the published figures everywhere:
View code
NAMES = {"TOTAL": "Total", "URBANA": "Urban", "RURAL": "Rural", "Sudeste": "Southeast","Nordeste": "Northeast", "Sul": "South", "Norte": "North", "Centro-Oeste": "Center-West",}def a4_cells(where=None): out = [("Total", "TOTAL", share(tic.estimation.prop(y="a4", where=where, method="replication"), "a4"))]for by in ["area", "cod_regiao_2"]: d = tic.estimation.prop(y="a4", by=by, where=where, method="replication").to_polars() d = d.filter(pl.col("a4").cast(pl.Float64) ==1).sort(by) out += [(by, r[f"{by}_label"], r) for r in d.to_dicts()]return outall_hh = a4_cells()known = a4_cells(where=svy.col("a4") <=1)print("| | svy, all households | svy, 97 and 98 dropped | Published |")print("|---|---:|---:|---:|")for (by, label, a), (*_, k) inzip(all_hh, known): pub = PUBLISHED[("A4", by, label.casefold())]print(f"| {NAMES[label]} | {a['est'] *100:.2f} | {k['est'] *100:.2f} | {pub} |")
svy, all households
svy, 97 and 98 dropped
Published
Total
86.30
86.45
86
Urban
86.99
87.13
87
Rural
80.92
81.07
81
Southeast
86.76
86.89
87
Northeast
84.49
84.58
84
South
89.39
89.56
89
North
83.06
83.11
83
Center-West
87.07
87.46
87
On the all-households base every rounded value matches. With 97 and 98 dropped, 2 of 8 cells round to a different whole percentage.
Every published cell
The same check over three household indicators, each by every published breakdown (total, area, region, the nine family-income rows and social class):
A1, households with a computer (a1_agreg);
A4, households with Internet access (a4);
A12, households with Wi-Fi among those with Internet access (a7a, with where=svy.col("a4") == 1).
63 of 63 published cells match after rounding half up. The published values, with the URL of each table, are in code/published.csv.
A12 is a subpopulation: households without Internet stay in the file and the where= argument selects the domain. Deleting them first gives the same estimate, but treats the size of the subpopulation as fixed when it is itself random.
Standard errors, against R
The web tables publish no margins of error, so the published tables check only the estimates. For the standard errors the reference is Thiago Meireles’ R survey run on the same file, with the same producer scale: A4 by area and A1 by region.
View code
VAR = {"A4": "a4", "A1": "a1_agreg"}svy_rows = {}for ind, by in [("A4", "area"), ("A1", "cod_regiao_2")]:for r in tic.estimation.prop(y=VAR[ind], by=by, method="replication").to_polars().to_dicts(): svy_rows[(ind, r[f"{by}_label"].casefold(), str(int(r[VAR[ind]])))] = ragree =0print("| Indicator | Domain | Category | Estimate, R | Estimate, svy | SE, R | SE, svy |")print("|---|---|---|---:|---:|---:|---:|")for ref in R_REFERENCE: r = svy_rows[(ref["indicator"], ref["domain"].casefold(), ref["category"])] agree +=abs(r["est"] -float(ref["est"])) <1e-6andabs(r["se"] -float(ref["se"])) <1e-6print(f"| {ref['indicator']} | {ref['domain']} | {ref['category']} "f"| {float(ref['est']):.6f} | {r['est']:.6f} | {float(ref['se']):.6f} | {r['se']:.6f} |" )
Indicator
Domain
Category
Estimate, R
Estimate, svy
SE, R
SE, svy
A4
URBANA
1
0.869906
0.869906
0.004602
0.004602
A4
URBANA
0
0.128482
0.128482
0.004512
0.004512
A4
URBANA
97
0.001452
0.001452
0.000409
0.000409
A4
RURAL
1
0.809164
0.809164
0.008636
0.008636
A4
RURAL
0
0.188962
0.188962
0.008584
0.008584
A4
RURAL
97
0.001851
0.001851
0.000881
0.000881
A1
Sudeste
1
0.376789
0.376789
0.014972
0.014972
A1
Nordeste
1
0.217300
0.217300
0.007479
0.007479
A1
Sul
1
0.370627
0.370627
0.014156
0.014156
A1
Norte
1
0.253914
0.253914
0.013751
0.013751
A1
Centro-Oeste
1
0.278927
0.278927
0.011757
0.011757
11 of 11 estimates and standard errors agree to six decimals, the precision he reported. His post used an earlier svy and rescaled its standard errors by hand to the producer’s convention; with scale= in svy.RepWeights, that step is no longer needed.
What explains the rural gap?
The published tables describe; they do not adjust. Rural households are less connected, but they also differ in income, region and education. How much of the gap is left once those are held fixed?
A description first: Internet access by social class
internet is yes when a4 is Sim and no otherwise, so don’t-know stays in the base, as published. A two-way table of row shares:
╭──────────── Table: Classe social × internet (row shares) ─────────────╮│││Classe social internet Estimate Std Err CV Lower Upper││ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ││ A No 0.2 0.2 1.1 0.0 1.9 ││ A Yes 99.8 0.2 0.0 98.1 100.0 ││ B No 1.7 0.7 0.4 0.7 3.8 ││ B Yes 98.3 0.7 0.0 96.2 99.3 ││ C No 8.2 0.6 0.1 7.1 9.5 ││ C Yes 91.8 0.6 0.0 90.5 92.9 ││ DE No 26.6 0.7 0.0 25.2 28.0 ││ DE Yes 73.4 0.7 0.0 72.0 74.8 ││││ Rao-Scott F(1.84, 365.31) = 121.28, p < 0.001 ││ Rao-Scott chi2(3) = 2150.85, p < 0.001 │╰───────────────────────────────────────────────────────────────────────╯
The row shares are the published A4 by class, from class A, the highest, to DE. The Rao-Scott test under the table corrects the chi-square for the design: a standard chi-square on weighted data treats the sample as simple random and finds association too easily. Here the association is overwhelming either way.
Adjusting one step at a time
A logistic regression of internet on area, adding region, family income and the schooling of the head of household in turn. The quantity of interest is the average marginal effect of area: the difference in the probability of Internet access, rural minus urban, averaged over the households.
Model
Rural minus urban (points)
95% CI
Area only
-6.1
-8.1 to -4.0
+ region
-5.4
-7.3 to -3.5
+ family income
-3.3
-5.2 to -1.5
+ schooling of the head
+0.4
-1.3 to +2.0
With area alone the marginal effect is the published gap, 80.9% rural against 87.0% urban. Region takes it to -5.4: rural households are more common in the Northeast and North, where access is lower for all households. Family income takes it to -3.3, and the schooling of the head to +0.4: rural and urban households with the same region, income and schooling have about the same access.
╭────────────────────────────────────────── GLM: Binomial (logit) ──────────────────────────────────────────╮│Modeling: internet││││Observations 27177 AIC 18534.7516 ││DF Residuals 185 BIC - ││Deviance 18400.7082 Scale 1.0612 ││R-squared 0.15238 R-sq (adj) 0.15194 ││Iterations 6 ││F-stat (adj) 61.87219 Prob (F-adj) <0.001 ││││││Term Coef. Std.Err. t P>|t| [0.025 0.975]││ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ││ _intercept_ -0.92680 0.13022 -7.11735 <0.001 -1.18371 -0.66990 ││ area_RURAL 0.03798 0.08211 0.46248 0.6443 -0.12402 0.19998 ││ cod_regiao_2_Nordeste 0.33948 0.09548 3.55562 <0.001 0.15111 0.52784 ││ cod_regiao_2_Sul 0.25224 0.12660 1.99243 0.0478 0.00248 0.50200 ││ cod_regiao_2_Norte -0.13329 0.10670 -1.24921 0.2132 -0.34380 0.07722 ││ cod_regiao_2_Centro-Oeste 0.13889 0.12229 1.13571 0.2575 -0.10238 0.38015 ││ renda_familiar_2_Mais de 1 SM até 2 SM 0.60806 0.07701 7.89554 <0.001 0.45613 0.76000 ││ renda_familiar_2_Mais de 2 SM até 3 SM 1.09656 0.17736 6.18283 <0.001 0.74666 1.44646 ││ renda_familiar_2_Mais de 3 SM até 5 SM 1.80417 0.43274 4.16919 <0.001 0.95043 2.65791 ││ renda_familiar_2_Mais de 5 SM até 10 SM 2.06327 0.38382 5.37566 <0.001 1.30605 2.82050 ││ renda_familiar_2_Mais de 10 SM 1.00607 0.70237 1.43240 0.1537 -0.37961 2.39175 ││ renda_familiar_2_Não tem renda -0.16305 0.23430 -0.69592 0.4874 -0.62529 0.29918 ││ renda_familiar_2_Não sabe 0.70110 0.18315 3.82811 <0.001 0.33978 1.06243 ││ renda_familiar_2_Não respondeu 0.15521 0.19444 0.79824 0.4258 -0.22840 0.53882 ││ grau_instrucao 0.78934 0.03958 19.94211 <0.001 0.71125 0.86743 │││╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Three choices in that call:
svy.Cat marks a categorical variable. Each level gets its own coefficient, printed with its label, and ref= names the reference level by its label, URBANA.
No household is dropped. The income bands keep Não tem renda (no income), Não sabe and Não respondeu as their own levels instead of discarding the households that gave no band.
Schooling enters as one numeric term, from 1 (illiterate or up to the third grade) to 5 (higher education completed). Entered as five categories it gives the same rural gap to the first decimal.
The standard errors come from refitting the model on each of the 200 replicate weights, and the residual degrees of freedom count replicates less model terms, not the 27,177 households.
Why not social class
Social class looks like the obvious control: it is one of the published breakdowns, and the gradient above is steep. It is the wrong one here, for two reasons.
It partly measures the outcome. The Brazilian Economic Classification Criterion scores durable goods, a computer among them, and the education of the head. A household with a computer is far more likely to have Internet access, so adjusting for class adjusts for part of the outcome itself.
It separates the outcome. Class A is almost entirely connected. In replicates that give zero weight to its few unconnected households, class A predicts the outcome perfectly, the class coefficients diverge, and the replicate variance cannot be computed.
╭────────────────────────────────── GLM: Binomial (logit) ──────────────────────────────────╮│Modeling: internet││││Observations 27177 AIC nan ││DF Residuals 191 BIC - ││Deviance 19346.0037 Scale 0.9983 ││R-squared 0.10883 R-sq (adj) 0.10857 ││Iterations 7 ││F-stat (adj) nan Prob (F-adj) nan ││││││Term Coef. Std.Err. t P>|t| [0.025 0.975]││ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ││ _intercept_ 5.97342 nan nan nan nan nan ││ area_RURAL 0.06323 0.07169 0.88196 0.3789 -0.07818 0.20464 ││ cod_regiao_2_Nordeste 0.54967 0.09467 5.80592 <0.001 0.36293 0.73641 ││ cod_regiao_2_Sul 0.27201 0.12123 2.24368 0.0260 0.03288 0.51114 ││ cod_regiao_2_Norte 0.30471 0.10236 2.97675 0.0033 0.10280 0.50662 ││ cod_regiao_2_Centro-Oeste 0.24467 0.12055 2.02962 0.0438 0.00689 0.48245 ││ classe_2015_B -2.01872 nan nan nan nan nan ││ classe_2015_C -3.73047 nan nan nan nan nan ││ classe_2015_DE -5.28661 nan nan nan nan nan ││││note: Outcome separated: some coefficients are not identified [GLM_SEPARATION]│╰───────────────────────────────────────────────────────────────────────────────────────────╯
The sample has 1 class A household without Internet access, and 70 of the 200 replicates give it zero weight.
svy flags the separation (GLM_SEPARATION) and reports no standard error for the terms it affects rather than a meaningless one. The area coefficient keeps its standard error, but the marginal effect of area depends on every coefficient and has none. As a description, class is fine: that is the two-way table above.
What this does not say
The model describes one year of data. It says that, at equal income, region and schooling, rural and urban households in 2025 have about the same Internet access; it does not say that raising rural incomes would close the gap. Income and schooling are themselves shaped by where households live, and the survey cannot separate those paths.
Reproducing this page
The data are free to download from Cetic.br, under CC BY 4.0 (credit Cetic.br|NIC.br):
Put the SPSS file in inputs/data/ next to this page. The published values and the R reference values are in code/.
References
Cetic.br|NIC.br (2025). Pesquisa sobre o uso das tecnologias de informação e comunicação nos domicílios brasileiros: TIC Domicílios 2025. Tables A1, A4, A12; main results.
Rao, J. N. K. and Scott, A. J. (1984). On chi-squared tests for multiway contingency tables with cell proportions estimated from survey data. Annals of Statistics, 12(1), 46–60.
TipCommunity signal
Help make svy the standard for survey analysis in Python
If rigorous, design-based survey inference in Python matters to you, starring the repository helps signal demand and prioritize validation and stability work.