# Parameters and parameter estimates

## Where is the model fitting information stored in MLwiN?

**Parameter storage columns:** MLwiN routinely stores the random parameter estimates in C1096 (for more information see the question ' Where can I find the random parameter matrix in MLwiN? How do I use this to work out the residual ('unexplained') variance at each level?'), and their variance-covariance estimates in C1097. Since the variance-covariance matrix is symmetric, C1097 contains only the elements in the lower triangle of the matrix. The fixed parameters and their variance-covariance matrix are stored in C1098 and C1099 respectively. They are the final estimates at convergence of the model. The fixed and random parameter estimates for each iteration, are stacked and stored. The -2log-likelihood values for each iteration are stacked and stored in C1091 (for normal response models only). If missing values are defined in the worksheet through the Options window, MLwiN stores in C1094 the binary code as 1 for missing and 0 for others. These columns should not be used by users to store data. If they do, their data in these columns will be overwritten without warning during estimation.

## Is it possible to output the error variance-covariance matrices for parameters?

Yes. The error variance-covariance matrix for random parameters is stored in c1097 and the error variance-covariance matrix for fixed parameters is stored in c1099 (see the FAQ Where is the model fitting information stored in MLwiN? for more details). Since these matrices are stored as columns in MLwiN, they can be output in the same way as any other column. For MLwiN version 2.10 Beta the simplest way is to use the **Copy** button in the **Names** window; for details of how to do this see Section 8.2.4 on p82 of the MLwiN version 2.10 Manual supplement. For MLwiN version 2.02, the way to output columns is using the **ASCII text file output** option from the **File** menu; for details of how to do this see our Getting data out of MLwiN.

## Is it possible to constrain parameters in MLwiN?

*Example question:* When running a model in MLwiN, is it possible to constrain some of the parameters so they are forced to take on specified values instead of being freely estimated?

Yes, it is possible to specify constraints for both fixed and random parameters, and parameters can be constrained to be 0 or to be any specified number. In addition it is possible to specify more complicated constraints such as that two parameters should be equal or that the difference between the parameters should be a specified value.

*See the FAQs How can I constrain random parameters to zero?, How can I constrain fixed parameters to zero?, How can I constrain parameters to values other than zero? and How can I constrain two parameters to be equal? for details of how to constrain parameters *

## How can I constrain random parameters to zero?

*Example question:* Is there a way of constraining some of the covariances between the random effects to equal 0?

- Yes, it is easy to constrain covariances between random effects to be zero. Simply select the relevant covariance in the matrix in the
**Equations**window, and in the window that appears asking whether you want to remove the covariance select**Yes**. The covariance will then be constrained to be zero as you will see since it will no longer appear as a coloured number with 3 decimal places but as a single digit 0 in black.

It is also possible to do this using the command CLRE; for documentation of this see p35 of the Command Manual.

*See also How can I constrain parameters to values other than zero? and How can I constrain fixed parameters to zero?*

## How can I constrain fixed parameters to zero?

It is possible to constrain a fixed parameter to be zero; however it is generally more sensible to remove the fixed parameter from the model (which is equivalent to constraining it to zero). This can be achieved by selecting on the term in the **Equations** window and unticking the first box, labelled **Fixed Parameter**, in the window that appears, then selecting **Done**. Any random effects for that variable will remain in the model (since any ticked boxes below the **Fixed Parameter** box remain ticked), and if there are no random effects for that variable, it will disappear entirely. Therefore this method will allow you to specify a model with random effects for a variable but no fixed effects for that variable (that is, fixed effects constrained to zero), or to delete the dummy variable for one category of a categorical variable while leaving the dummy variables for the other categories in. Note that it is important when doing either of these things to be sure that this is something that makes sense given your data, model and research question.

It is also possible to remove a fixed parameter from the model using the command FPAR. Type FPAR 0 C, where C is the variable for which you do not want a fixed parameter to appear in the model. For example, if you are working with the **tutorial** dataset and wish to add **vrband** as an explanatory variable (with reference category **vb1**) but only want a dummy for **vb2** to appear in the model, then after adding **vrband** in the usual way, type FPAR 0 'vb3'. FPAR 1 C will put variable C back in the fixed part of the model. For documentation of FPAR, see the Command Manual

## How can I constrain parameters to values other than zero?

*NB see also the FAQs How can I constrain random parameters to zero?* and * How can I constrain fixed parameters to zero?*

To do this using the GUI, first set up your model in the **Equations** window and then select **Constrain Parameters** from the **Model** menu. In the window that appears, select **random** or **fixed** as appropriate (near the bottom of the window), select a free column from the drop down box **store constraint matrix for random **[or **fixed**] **parameters in** and in the box **# of constraints** type the number of (fixed or random) parameters you want to constrain. A column will appear at the top of the window for each constraint. Using one column for each parameter, type a **1** in the row corresponding to that parameter, and the number you want to constrain it to in the row **to equal**. When you have entered all the constraints, select the button at the bottom of the window **attach fixed constraints** or **attach random constraints**.

For example, suppose you are working with the** tutorial **dataset supplied with MLwiN and want to estimate a two level model (with **school** as level 2 and **student** as level 1) with a random slope on **standlrt**, and that you want to constrain the variance of the random slope to be 0.5 and the covariance between intercepts and slopes to be 0.001. (Note that this is just for the purposes of illustration and it should not be inferred that this would be a sensible thing to do or that these would be sensible values to choose in this particular situation). First of all, set up the random slopes model in the **Equations** window. Then select **Constrain Parameters** from the **Model** menu. In the window that appears select **random** at the bottom because we are constraining variances and covariances which are random parameters. In the box **# of constraints** type **2** because we are constraining two parameters, the variance of the slopes and the covariance between intercepts and slopes. Now in the first column at the top of the window type **1** in the third row (because this is labelled **school: standlrt/standlrt** so it refers to the variance of the level 2 random effect on **standlrt**: i.e. it is the variance of the random slopes) and in the last row type **0.5** (because this is the value we want to constrain the variance to equal). Then in the second column type a **1** in the second row (because this is labelled **school: standlrt/cons** so it refers to the covariance between the level 2 random effect on **cons** and the level 2 random effect on **standlrt** so it is the covariance between intercepts and slopes) and in the last row type **0.001**. Then select **c11** (or any other free column) from the drop down box **store constraint matrix for random parameters in** and select the button **attach random constraints** at the bottom of the window.

Note:

- the constraints remain stored in the column you have chosen (
**c11**in this case) and if you want to use them again you can select the**load matrix from**button and select**c11**from the drop down box that appears, rather than enter them in the columns - more complicated constraints can also be specified this way: for example you can specify that two parameters should be equal (but not take on any specific value).
*See the FAQ How can I constrain two parameters to be equal? for how to do this.* - this method can also be used to constrain parameters to zero, though there are quicker and easier ways to constrain parameters to zero via the Equations window (
*see FAQs How can I constrain random parameters to zero? and How can I constrain fixed parameters to zero?*)

There are also commands to do this. For random parameters (the variances and covariances) the command is **RCON** and documentation can be found on p40 of the Command manual. For fixed parameters (the betas) the command is **FCON** and documentation can be found on p37 of the Command manual.

## How can I constrain two parameters to be equal?

*NB see also the FAQs How can I constrain random parameters to zero?, How can I constrain fixed parameters to zero? and How can I constrain parameters to values other than zero?*

Constraining two parameters to be equal can be done via the **Parameter constraints** window accessed from the **Constrain Parameters** option from the **Model** menu (*see the FAQ How can I constrain parameters to values other than zero?*). Select **fixed** or **random** as appropriate at the bottom of the window, and in the **# of constraints** box, type 1 (this is the default so may already be entered). In the column labelled **#1** at the top of the window, type a 1 nex t to one of the parameters and a -1 next to the other (it doesn't matter which way round). Next to **to equal**, type 0 (this is the default so it may already be entered). Choose a free column from the **store constraint matrix for fixed parameters in** drop-down box and select the **attach fixed constraints** or **attach random constraints** button at the bottom of the window. The difference between the two parameters is now constrained to be 0, which is equivalent to constraining the two parameters to be equal.

Alternatively, this can be done via a command. For random parameters (the variances and covariances) the command is **RCON** and documentation can be found on p40 of the Command manual. For fixed parameters (the betas) the command is **FCON** and documentation can be found on p37 of the Command manual.

## Other questions about parameters

- Where can I find the random parameter matrix in MLwiN? How do I use this to work out the residual ('unexplained') variance at each level?
- What significance tests for both random and fixed parameters are available in MLwiN?
- How do I test whether two coefficients are equal?
- How do I test whether more than 2 coefficients are equal?
- How do I test if an interaction between a continuous and a categorical variable is significant?
- How can I calculate confidence intervals in MLwiN?