History of teenage_friends
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/teenage_friends/__init__.py b/entries/teenage_friends/__init__.py
index 651182b..69014b9 100644
--- a/entries/teenage_friends/__init__.py
+++ b/entries/teenage_friends/__init__.py
@@ -45,7 +45,7 @@ url = 'https://www.stats.ox.ac.uk/~snijders/siena/Glasgow_data.htm'
citation = [('L. Michell, A. Amos, "Girls, pecking order and smoking." Social Science & Medicine 44(12), 1861-1869 (1997)', 'https://doi.org/10.1016/S0277-9536(96)00295-X'),
('M. Pearson, L. Michell, "Smoke Rings: social network analysis of friendship groups, smoking and drug-taking." Drugs: Education, Prevention and Policy 7(1), 21-37 (2000)', 'https://doi.org/10.1080/713660095'),
('C. Steglich, T. A. B. Snijders, M. Pearson, "Dynamic networks and behavior: Separating selection from influence." Sociological Methodology 40(1), 329-393 (2010)', 'https://doi.org/10.1111/j.1467-9531.2010.01225.x')]
-icon_hash = '5944aab14ed8f1bb6022a49c'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://www.stats.ox.ac.uk/~snijders/siena'
rfiles = ["friendship", "demographic", "substances", "various", "geographic",
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/teenage_friends/__init__.py b/entries/teenage_friends/__init__.py
index 1e59a32..651182b 100644
--- a/entries/teenage_friends/__init__.py
+++ b/entries/teenage_friends/__init__.py
@@ -26,8 +26,20 @@ A directed edge (i, j) indicates that pupil i named pupil j as a friend.
The networks have the following properties:
-- Nodes: `name`, the pupil identifier; `present`, whether the pupil was part of the cohort at this time point; `sex` (1: boy, 2: girl); `age`, the age in years on 1 January 1995; `alcohol`, alcohol consumption (1: non, 2: once or twice a year, 3: once a month, 4: once a week, 5: more than once a week); `tobacco`, tobacco use (1: non, 2: occasional, 3: regular, i.e. more than once per week); `cannabis`, cannabis use (1: non, 2: tried once, 3: occasional, 4: regular); `money`, pocket money per month in British pounds; `romantic`, whether the pupil had a romantic relation (1: no, 2: yes); `smoking_at_home`, `parent_smoking` and `sibling_smoking`, smoking at home, by at least one parent and by at least one sibling (1: no, 2: yes; first non-missing value over the three time points); `dist_school`, the distance between the pupil's home and the school in kilometers; `selection129`, whether the pupil is one of the 129 present at all time points; `selection50`, whether the pupil is one of the 50 girls of the "s50" excerpt. The variables `alcohol`, `tobacco`, `cannabis`, `money`, `romantic` and `dist_school` refer to the time point of the network. Missing values are -1 (or NaN for `money`, `age` and `dist_school`).
-- Edges: `relation`, the type of friendship (1: best friend, 2: just a friend)."""
+- (Node) `name`: the pupil identifier.
+- (Node) `present`: whether the pupil was part of the cohort at this time point.
+- (Node) `sex` (1: boy, 2: girl).
+- (Node) `age`: the age in years on 1 January 1995.
+- (Node) `alcohol`: alcohol consumption (1: non, 2: once or twice a year, 3: once a month, 4: once a week, 5: more than once a week).
+- (Node) `tobacco`: tobacco use (1: non, 2: occasional, 3: regular, i.e. more than once per week).
+- (Node) `cannabis`: cannabis use (1: non, 2: tried once, 3: occasional, 4: regular).
+- (Node) `money`: pocket money per month in British pounds.
+- (Node) `romantic`: whether the pupil had a romantic relation (1: no, 2: yes).
+- (Node) `smoking_at_home`, `parent_smoking` and `sibling_smoking`: smoking at home, by at least one parent and by at least one sibling (1: no, 2: yes; first non-missing value over the three time points).
+- (Node) `dist_school`: the distance between the pupil's home and the school in kilometers.
+- (Node) `selection129`: whether the pupil is one of the 129 present at all time points.
+- (Node) `selection50`: whether the pupil is one of the 50 girls of the "s50" excerpt. The variables `alcohol`, `tobacco`, `cannabis`, `money`, `romantic` and `dist_school` refer to the time point of the network. Missing values are -1 (or NaN for `money`, `age` and `dist_school`).
+- (Edge) `relation`: the type of friendship (1: best friend, 2: just a friend)."""
tags = ['Social', 'Offline', 'Weighted', 'Metadata', 'Temporal']
url = 'https://www.stats.ox.ac.uk/~snijders/siena/Glasgow_data.htm'
citation = [('L. Michell, A. Amos, "Girls, pecking order and smoking." Social Science & Medicine 44(12), 1861-1869 (1997)', 'https://doi.org/10.1016/S0277-9536(96)00295-X'),
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/teenage_friends/__init__.py b/entries/teenage_friends/__init__.py
index 447b397..1e59a32 100644
--- a/entries/teenage_friends/__init__.py
+++ b/entries/teenage_friends/__init__.py
@@ -49,7 +49,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] Use American spelling in the descriptions 802d564
British spellings in the titles and descriptions of 69 entries (e.g. labelled, organisation, millimetres, centres, anonymised, neighbours, analysed, modelled, colour, licence) are replaced by the American ones. Proper names keep their spelling (Otago Harbour, the Centre for Water Systems, the Centre jeunesse de Montréal, the Dutch Ministry of Defence), as do quoted upstream terms, citations, and property names.
diff --git a/entries/teenage_friends/__init__.py b/entries/teenage_friends/__init__.py
index 1a62a3b..447b397 100644
--- a/entries/teenage_friends/__init__.py
+++ b/entries/teenage_friends/__init__.py
@@ -26,7 +26,7 @@ A directed edge (i, j) indicates that pupil i named pupil j as a friend.
The networks have the following properties:
-- Nodes: `name`, the pupil identifier; `present`, whether the pupil was part of the cohort at this time point; `sex` (1: boy, 2: girl); `age`, the age in years on 1 January 1995; `alcohol`, alcohol consumption (1: non, 2: once or twice a year, 3: once a month, 4: once a week, 5: more than once a week); `tobacco`, tobacco use (1: non, 2: occasional, 3: regular, i.e. more than once per week); `cannabis`, cannabis use (1: non, 2: tried once, 3: occasional, 4: regular); `money`, pocket money per month in British pounds; `romantic`, whether the pupil had a romantic relation (1: no, 2: yes); `smoking_at_home`, `parent_smoking` and `sibling_smoking`, smoking at home, by at least one parent and by at least one sibling (1: no, 2: yes; first non-missing value over the three time points); `dist_school`, the distance between the pupil's home and the school in kilometres; `selection129`, whether the pupil is one of the 129 present at all time points; `selection50`, whether the pupil is one of the 50 girls of the "s50" excerpt. The variables `alcohol`, `tobacco`, `cannabis`, `money`, `romantic` and `dist_school` refer to the time point of the network. Missing values are -1 (or NaN for `money`, `age` and `dist_school`).
+- Nodes: `name`, the pupil identifier; `present`, whether the pupil was part of the cohort at this time point; `sex` (1: boy, 2: girl); `age`, the age in years on 1 January 1995; `alcohol`, alcohol consumption (1: non, 2: once or twice a year, 3: once a month, 4: once a week, 5: more than once a week); `tobacco`, tobacco use (1: non, 2: occasional, 3: regular, i.e. more than once per week); `cannabis`, cannabis use (1: non, 2: tried once, 3: occasional, 4: regular); `money`, pocket money per month in British pounds; `romantic`, whether the pupil had a romantic relation (1: no, 2: yes); `smoking_at_home`, `parent_smoking` and `sibling_smoking`, smoking at home, by at least one parent and by at least one sibling (1: no, 2: yes; first non-missing value over the three time points); `dist_school`, the distance between the pupil's home and the school in kilometers; `selection129`, whether the pupil is one of the 129 present at all time points; `selection50`, whether the pupil is one of the 50 girls of the "s50" excerpt. The variables `alcohol`, `tobacco`, `cannabis`, `money`, `romantic` and `dist_school` refer to the time point of the network. Missing values are -1 (or NaN for `money`, `age` and `dist_school`).
- Edges: `relation`, the type of friendship (1: best friend, 2: just a friend)."""
tags = ['Social', 'Offline', 'Weighted', 'Metadata', 'Temporal']
url = 'https://www.stats.ox.ac.uk/~snijders/siena/Glasgow_data.htm'
[entries] New entry: teenage_friends c3e1308
diff --git a/entries/teenage_friends/__init__.py b/entries/teenage_friends/__init__.py
new file mode 100644
index 0000000..1a62a3b
--- /dev/null
+++ b/entries/teenage_friends/__init__.py
@@ -0,0 +1,98 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+from .. import *
+
+title = "Teenage Friends and Lifestyle Study (1995-1997)"
+description = """Friendship networks among the pupils of the older cohort of a secondary school in Glasgow (Scotland), from the Teenage Friends and Lifestyle Study, which aimed to identify how attitudes towards smoking and smoking behaviour change over early to mid adolescence. The study was carried out by L. Michell and P. West of the MRC Medical Sociology Unit, University of Glasgow. The pupils were followed over their second, third and fourth year at the school, from February 1995 (when they were aged 13) to January 1997, at three measurement points (`t1` to `t3`). A total of 160 pupils were part of the cohort, of which 129 were present at all three time points. Pupils could name up to six friends; at the first time point, a second questionnaire allowed up to six more nominations, which were censored in this release for consistency over time. The school was representative of others in the region in terms of social class composition. The data were distributed by T. Snijders with the SIENA software (release of July 2026). The frequently used "s50" excerpt of 50 girls is a subset of an earlier release of these data.
+
+A directed edge (i, j) indicates that pupil i named pupil j as a friend.
+
+The networks have the following properties:
+
+- Nodes: `name`, the pupil identifier; `present`, whether the pupil was part of the cohort at this time point; `sex` (1: boy, 2: girl); `age`, the age in years on 1 January 1995; `alcohol`, alcohol consumption (1: non, 2: once or twice a year, 3: once a month, 4: once a week, 5: more than once a week); `tobacco`, tobacco use (1: non, 2: occasional, 3: regular, i.e. more than once per week); `cannabis`, cannabis use (1: non, 2: tried once, 3: occasional, 4: regular); `money`, pocket money per month in British pounds; `romantic`, whether the pupil had a romantic relation (1: no, 2: yes); `smoking_at_home`, `parent_smoking` and `sibling_smoking`, smoking at home, by at least one parent and by at least one sibling (1: no, 2: yes; first non-missing value over the three time points); `dist_school`, the distance between the pupil's home and the school in kilometres; `selection129`, whether the pupil is one of the 129 present at all time points; `selection50`, whether the pupil is one of the 50 girls of the "s50" excerpt. The variables `alcohol`, `tobacco`, `cannabis`, `money`, `romantic` and `dist_school` refer to the time point of the network. Missing values are -1 (or NaN for `money`, `age` and `dist_school`).
+- Edges: `relation`, the type of friendship (1: best friend, 2: just a friend)."""
+tags = ['Social', 'Offline', 'Weighted', 'Metadata', 'Temporal']
+url = 'https://www.stats.ox.ac.uk/~snijders/siena/Glasgow_data.htm'
+citation = [('L. Michell, A. Amos, "Girls, pecking order and smoking." Social Science & Medicine 44(12), 1861-1869 (1997)', 'https://doi.org/10.1016/S0277-9536(96)00295-X'),
+ ('M. Pearson, L. Michell, "Smoke Rings: social network analysis of friendship groups, smoking and drug-taking." Drugs: Education, Prevention and Policy 7(1), 21-37 (2000)', 'https://doi.org/10.1080/713660095'),
+ ('C. Steglich, T. A. B. Snijders, M. Pearson, "Dynamic networks and behavior: Separating selection from influence." Sociological Methodology 40(1), 329-393 (2010)', 'https://doi.org/10.1111/j.1467-9531.2010.01225.x')]
+icon_hash = '5944aab14ed8f1bb6022a49c'
+upstream_license = None
+upstream_prefix = 'https://www.stats.ox.ac.uk/~snijders/siena'
+rfiles = ["friendship", "demographic", "substances", "various", "geographic",
+ "selections"]
+files = [(tuple(f"Glasgow_data.zip:Glasgow-{f}.RData" for f in rfiles) +
+ ("Glasgow_data.zip:cc.txt",), f"t{t}", None) for t in range(1, 4)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ t = int(alt[1:])
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "rb"))
+ for fn in fnames]
+ d = {}
+ for f in fs[:-1]:
+ d.update(read_rdata(f))
+ cc = [[float(x) for x in line.split()]
+ for line in fs[-1].read().decode().splitlines() if line.strip()]
+
+ def matrix(k, missing=numpy.nan):
+ vals, attrs = d[k]
+ m = numpy.array([missing if x is None else x for x in vals], dtype="float")
+ if "dim" in attrs:
+ m = m.reshape(attrs["dim"], order="F")
+ return m, attrs.get("dimnames")
+
+ A, dimnames = matrix(f"friendship.{t}")
+ N = A.shape[0]
+ g = Graph(directed=True)
+ g.add_vertex(N)
+ g.vp.name = g.new_vp("string", vals=dimnames[0])
+ g.vp.present = g.new_vp("bool", vals=[s <= t <= e for s, e in cc])
+ g.vp.sex = g.new_vp("int", vals=matrix("sex.F", -1)[0])
+ g.vp.age = g.new_vp("double", vals=matrix("age")[0])
+ for k in ["alcohol", "tobacco", "cannabis", "romantic"]:
+ g.vp[k] = g.new_vp("int", vals=matrix(k, -1)[0][:, t - 1])
+ g.vp.money = g.new_vp("double", vals=matrix("money")[0][:, t - 1])
+ fsm = matrix("familysmoking", -1)[0]
+ for i, k in enumerate(["smoking_at_home", "parent_smoking", "sibling_smoking"]):
+ g.vp[k] = g.new_vp("int", vals=fsm[:, i])
+ g.vp.dist_school = g.new_vp("double", vals=matrix("dist.school")[0][:, t - 1])
+ for k in ["selection129", "selection50"]:
+ g.vp[k] = g.new_vp("bool", vals=matrix(k, 0)[0])
+
+ # 1: best friend, 2: just a friend, 10: structural absence, NaN: missing
+ A[numpy.isnan(A) | (A == 10)] = 0
+ numpy.fill_diagonal(A, 0)
+ i, j = A.nonzero()
+ g.ep.relation = g.new_ep("int")
+ g.add_edge_list(numpy.array([i, j, A[i, j]]).T, eprops=[g.ep.relation])
+ yield alt, g