Title: MLwiN a few pointers
1MLwiN a few pointers
In this session we give a little guidance as to
how MLwiN works for some generic functions data
import, data manipulation and graphing.
Using MlwiN for statistical modelling is not the
topic of this session, that will be covered in
later practical sessions.
2Data import
The latest version of MLwiN can directly import
and export STATA, MINITAB and SPSS. These options
are located on the File Menu(Open and Save
worksheet)
Sometimes it is convenient to paste data in from
the clipboard, see http//www.cmm.bristol.ac.uk/ML
wiN/tech-support/support-faqs/data-in/index.shtml
TIP dont import vast numbers of variables.
Concentrate on the ones you need. Usually
somewhere between 5 and 50 is appropriate.
3Commands and GUI
MLwiN has a Graphical User Interface(GUI) and a
scripting language
In this workshop we will use the GUI almost
exclusively. However, some enthusiasts may want
to learn the scripting language. It is
documentented in the Help system. A slightly out
of date command manual can be downloaded
from http//www.cmm.bristol.ac.uk/MLwiN/download/m
anuals.shtml
Many people use the package of their choice for
data management and then import to MLwiN for
multilevel modelling and visualations.
Other people use MlwiN for data management and
preparation as well as multilevel analysis.
4Opening the software
Menus with options for data manipulation,
graphics and modelling
Options for controlling model estimation
Work area where windows for specific tasks appear
Progress reporting
5Opening a worksheet
Variable summary window called the Names window
always appears
6Names window-one row per variable
Toggle selected variable categorical/numeric
View data for selected variables
View/edit category names
Naming/renaming vaiables
Enter additional descriptive text for variable
View only columns containing data
Defining a variable as categorical or numeric
effects how the variable is treated when entered
into a model
7Data Manipulation Menu
Many common data manipulation, viewing and
editing tasks can be achieved via windows brought
up the Data Manipulation menu. For example
selecting Data Manipulation?View or Edit Data
The data window with one row per Case
Note this data is arranged as a flat file with
values for school level variables repeated
But be careful
8MLwiN is not a strict record based system
MlwiN has, by default, 1500 columns that can
contain variables. Can be increased by selecting
Worksheet from the Options menu
MLwin is not a record based system it will allow
variables to be of different lengths in a
worksheet. It is like a spread sheet in this
respect. Be careful variables can get out of
alignment
9Getting things out of alignment
For example if we sort on variable Normexam alone
it is out of alignment
Clicking undo button returns the data
10Carrying Re-ordering and selection operations
When we re-order a variable or change the length
of a variable we must explicitly carry all
other variables that are linked horizontally in
the same record.
The sort window has a similar structure to many
of the data manipulation windows in MlwiN. So
carrying with the sort window, to ensure
everything stays lined up, looks like this
11Carrying..
Left panel defines operation
Variables to be carried
Destination columns, same as input or new
Buttons for removing particular actions, removing
all actions, executing the actions, or undoing
the actions
Right panel lists actions requested
NOTE UNDO only available while the selected
data manipulation window for the task at hand(in
this case sort) is open, so inspect data before
closing the the particular data manipulation
window you are using.
12Missing Data
If you have a single value coding for missing
data, you can set this via Options?Numbers
If you are importing a STATA, SPSS or MINITAB
worksheet, MLwiN should recognise the system
missing codes from these software packages
If you paste data in and a variable has a unique
non-numeric code sequence such as or .
or ??? the unique non-numeric code will be
interpreted as missing.
13Graphics
MLwiN has a range of graphical functionality,
including various types of static and
interactive visualisation to aid in model
interpretation and exploration. For the moment we
review some of the standard graphics available
via the Graphs?Customised Graphs window
14Three layers of graphics output available
They can be specified by the customised graphs
window. Firstly a Display. A Display can contain
multiple graphs. A Display can contain up to 25
graphs. Only one display can be viewed at a time.
But you can have up to ten displays and switch
between them.
Secondly, a graph. There are two in this display
Finally, a graph can contain multiple data sets.
A data set is a single variable(for histograms)
and an x-y pair of variables for other plots. The
left graph is a histogram of the variable
normexam. The right graph contains two data sets.
Ynormexam, Xstandlrt (in blue)and Ynormexam
Xgender(in red)
15Filling out the customised graph window
16Save your worksheet
If you save a worksheet, it saves the data and
any current graphs and the current statistical
model and its results and any tables of results
from multiple models you have built.
Save your worksheet regularly. Regard anything
unsaved as hostage to fortune either a system
crash or a user mistake that leads to data
being irreversibly re-arranged eg deleting
columns, getting variables out of alignment.