How to estimate the size of a Dataset
An approximated calculation for the size of a dataset is:
where:
In approximating W, remember:
Type of variable | Width |
Integers, −127 <= x <= 100 | 1 |
Integers, 32,767 <= x <= 32,740 | 2 |
Integers, -2,147,483,647 <= x <= 2,147,483,620 | 4 |
Floats single precision | 4 |
Floats double precision | 8 |
Strings | maximum lenght |
Say that you have a 20,000-observation dataset. That dataset contains
Thus the average width of a variable is:
The size of your dataset is:
This result slightly understates the size of the dataset because we have not included any variable labels, value labels, or notes that you might add to the data. That does not amount to much. For instance, imagine that you added variable labels to all 20 variables and that the average length of the text of the labels was 22 characters.
That would amount to a total of 20*22=440 bytes or 440/10242=.00042 megabytes.
Explanation of formula
N*V*W is, of course, the total size of the data. The 1,0242 in the denominator rescales the results to megabytes.
Yes, the result is divided by 1,0242 even though 1,0002 = a million. Computer memory comes in binary increments. Although we think of k as standing for kilo, in the computer business, k is really a “binary” thousand, 210 = 1,024. A megabyte is a binary million—a binary k squared:
With cheap memory, we sometimes talk about a gigabyte. Here is how a binary gig works:
Last updated