1 / 9

Restructuring longitudinal data

Restructuring longitudinal data. A guide to the unknown…. What is longitudinal data?.

raheem
Download Presentation

Restructuring longitudinal data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Restructuring longitudinal data A guide to the unknown…

  2. What is longitudinal data? • A dataset is longitudinal if it tracks the same type of information on the same subjects at multiple points in time or space. For example, part of a longitudinal dataset could contain specific students and their standardized test scores in six successive years. • One type of Longitudinal data is also known as “Panel data” and is data from a (usually small) number of observations over time on a (usually large) number of cross-sectional units like individuals, households, firms, or governments.

  3. Examples • Subset of hierarchical data — observations that are correlated because there is some tie to same unit. • E.g. in educational studies, where we observe student i in school u. Presumably there is some tie between the observations in the same school. • In such data, observe yj,u where u indicates a unit and j indicates the j’th observation drawn from that unit. Thus no relationship between yj,u and yj,u’ even though they have the same first subscript. • In true longitudinal data, t represents comparable time.

  4. Why Restructure? • One approach to working with longitudinal data sets is to restructure the data set- either going from one observation per subject to several or vice versa. For example, you may have several diagnosis codes in a single observation (visit) and want to compute frequencies of each possible diagnosis code. To do this, you will find it more convenient to have one observation for each diagnosis code, resulting in possibly several observations per subject.

  5. Restructuring the Data • Data structure analysis includes making sure that all the components of the data structures are closely related, that closely related data are not in separate structures, and that the best type of data structure is being used. The data may be a lot easier to manage and understand when it is a representation which tries to abstract its relevant similarities. • Often, in data warehouses, data restructuring involves changing some aspects of the way wherein the database is logically or physically arranged.

  6. Restructuring the Data Cont. • There are generally four types of data restructuring operations namely: • Trimming  • Flattening  • Stretching  • Grafting • In trimming, the extracted data from the input is placed in the output without having to change any of the change in the hierarchical relationships but some unwanted components of the data removed. • In flattening, the operation produced a form from a structure branch of an input by extracting all information at the level of the values of the basic attributes of the branch. • The stretching operating can produce a data structure output which has hierarchical levels than the input. • Finally, a grafting operating involves combining two hierarchies horizontally to form a wider hierarchy by matching common values.

  7. Restructuring longitudinal data • In SPSS you go to data/restructure. This allows you to restructure your data from multiple variables(columns) in a single case to groups of related cases(rows) or vice versa, or you can choose to transpose your data. • SPSS SYNTAX: • VARSTOCASES • /ID=id • /MAKE trans1 FROM VAR00001 VAR00002 VAR00003 VAR00004 • /INDEX=Index1(4) • /KEEP= • /NULL=KEEP.

  8. Restructuring longitudinal data in SAS • You can create observations using an array staement and a do loop or you can simply transpose the existing data. • data neonatal; • infile 'F:\Thesis Docs\Data\neonatal.txt' delimiter='09'x truncoverdsdmissoverobs=104; • input location $ _1990_ _1991_ _1992_ _1993_ _1994_ _1995_ _1996_ _1997_ _1998_ _1999_ _2000_ _2001_ _2002_ _2003_ _2004_ _2005_ _2006_ _2007_; • run; • proc sort data=neonatal; • by location; • run; • proc transpose data=neonatal • out=neonatal2 • name=year • prefix=neonatal; • by location; • var _1990_ _1991_ _1992_ _1993_ _1994_ _1995_ _1996_ _1997_ _1998_ _1999_ _2000_ _2001_ _2002_ _2003_ _2004_ _2005_ _2006_ _2007_; • run; • data neonatal3 (drop=neonatal2); • set neonatal2; • run; • proc print data=neonatal3 noobs; • run;

  9. Conclusion • Restructuring is fun!

More Related