constructing data matrices