Jig:Saw’s puzzle solutions
In Chapter 13, we looked at an example of how big a correlation there was between openness to new relationships (Alternatives) and the extent to which your partner matched your ideal (Ideal). The data are in Table 13.4 (in the book and reproduced below). Calculate the parameters of the linear model for openness to new relationships being predicted from how closely a partner matches the person’s ideal.
Table 13.4 (reproduced): Data on neuroticism and relationship commitment based on Kurdek (1997)
Openness to new relationships is represented by the variable Alternatives, and we want to predict this variable from Ideal, which is how closely a partner matches the person’s ideal. The model can be expressed as follows:
The parameters mentioned in the puzzle allude to the two values of b. This puzzle is, therefore, asking us to calculate estimates for b0 and b1 in the model. The first step is to calculate the squared deviations for the predictor variable (Ideal), which are shown in Table 1 (column 5) and also the cross-product deviations, which are shown in the final column of Table 1. We add the squared deviations to get the value of 12.4 shown at the bottom of column 5, and we also add the cross-product deviations to get the value of -7.6 shown at the bottom of the final column.
To calculate an estimate of b1 we divide the sum of cross-product deviations by the sum of squared deviations for the predictor as follows:
Table 1: Calculating cross-product deviations
Now, on to the constant, b0; this value tells us about the overall level of the outcome variable. I have put hats on the bs to remind you that these are estimated values. If we want to make the constant, b0, the subject of the equation that defines the model we rearrange it:
If we replace the X and Y with the symbols for their respective means, and plug the values of those means in (see Table 1) we can estimate the constant, b0:
Compute the confidence intervals for the parameters of the model in puzzle 1.
First, we need to calculate the standard error of b1. To do this we need to calculate the residual for each data point by looking at the difference between the observed value of the outcome and the value predicted by the model. Table 2 shows the raw data and in column 4 the model for the particular participant, which uses the values of b computed in puzzle 1. Column 5 shows the predicted value from the model for each person calculated from column 4. Column 6 shows the residual for each person; that is, the observed value of Alternatives (column 2) minus the predicted value of Alternatives (column 5). The final column shows these residuals squared. We add these squared residuals to give us the sum of squared residuals for the model, SSR.
We use the sum of squared residuals to calculate the mean squared error for the model. Essentially we’re converting the sum to an average. We do this by dividing by the degrees of freedom, which is the number of observations, N, minus the number of parameters, p. There are 10 observations, and 2 parameters (b0 and b1) giving us 8 degrees of freedom. The mean squared error for the model is 1.78:
Table 2: Calculating the sum of squared residuals
The standard error for the model is the square root of the mean squared error:
The standard error for the parameter b1 is the standard error for the model divided by the square root of the sum of squares for the predictor variable. We calculated the latter value in puzzle 1 (Table 1) as 12.4. Therefore, the standard error for b1 is:
To get the confidence interval, we use the value of the parameter calculated in puzzle 1 (−0.61) and add or subtract from it the standard error multiplied by a critical value representing the probability level of the confidence interval. We want a 95% confidence interval, so to get this critical value we use the degrees of freedom (in this case 8) and then look up the critical value for t (Section A.2 in the book) for 8 degrees of freedom with a proportion of 0.05 (5%) spread across the two tails of the distribution. This value is 2.306. If we plug these numbers into the equation we get a lower bound of −1.48 and an upper bound of 0.26:
Compute the standardized beta for the parameter for the variable Ideal in the model in puzzle 1. What do you notice about this value and that of the correlation coefficient between the variables Ideal and Alternatives in Chapter 13?
To compute the standardized beta we’d use this equation:
We computed the value of b in puzzle 1 and the standard deviations for the predictor (Ideal, sx) and outcome (Alternatives, sy) are in Table 13.4 (reproduced in the answer to puzzle 1). Place these values into the equation and you’ll see that the standardized beta is −0.492 (rounded off, that’s −0.5).
When the model has only one predictor, as in the current example, the standardized beta is the same as the correlation coefficient (r). If we look back at equation (13.22) from the book (reproduced below) we can see that the correlation coefficient for the variables Ideal and Alternatives was −0.5, the same (within rounding) as the standardized beta that we just calculated.
Write out the model in puzzle 1. What value of Alternatives would you expect if someone had scored 6 on the variable Ideal?
The model can be written as:
If someone scored 6 on the variable Ideal, then we would replace Ideali in the model with this value and solve the equation. Our model predicts that if someone had scored 6 on the variable Ideal then the value of Alternatives is 1.31:
Calculate the model sum of squares, total sum of squares and residual sum of squares for the model in puzzle 1. What do these values each represent?
Total sum of squares
The total sum of squares SST uses the differences between the observed data and the mean value of the outcome. It is the total amount of error present when we predict the outcome from its typical value - the mean - rather than from a predictor variable. I have calculated the total sum of squares in Table 3. Column 2 shows the observed values of Alternatives. The mean of these values is 2.90, which we could calculate but is also given in Table 13.4 (reproduced in puzzle 1). Column 3 shows this mean subtracted from each of the observed values, and column 4 shows these residuals squared. The total sum of squares is the sum of this final column, and is 18.90.
Table 3: Calculating the total sum of squares
The residual sum of squares
The residual sum of squares, SSR, represents the error in prediction when the best linear model is fit to the data: if the squared differences are large, the model is not representative of the data; if the squared differences are small, the model is representative. We have already calculated the residual sum of squares in puzzle 2 (see Table 2) and got a value of 14.24:
The model sum of squares
The model sum of squares, SSM, represents the improvement in prediction resulting from using the best model instead of the mean of the outcome; in other words, it is the difference between SST and SSR. This difference is the reduction in the error of prediction that results from fitting the linear model to the data and can be calculated as follows:
Use the values in puzzle 5 to calculate the F-ratio. Is the model a significant fit to the data?
The equation for the F-ratio is:
Therefore, to calculate the F-ratio we first need to convert the model and residual sums of squares to the mean squares for the model (MSM) and the residual mean squares (MSR) by diving by their respective degrees of freedom:
We calculated the SSM in puzzle 5 as 4.66, and the degrees of freedom for SSM will always be one less than the number of parameters estimated. In this model there are two parameters (b0 and b1 – see puzzle 1). The degrees of freedom are, therefore, 2−1 = 1.
We calculated the SSR in puzzle 5 to be 14.24, and the degrees of freedom for SSR are the total sample size minus the number of parameters. The total sample size in the current example is 10 and there are 2 parameters in the model (see above). The degrees of freedom are, therefore, 10 – 2 = 8. The resulting mean squares is 1.78:
Having calculated the mean squares, we can calculate the F-ratio:
To work out whether this value of F is significant we have to look up the critical value for an F-distribution with dfM = 1, and dfR = 8. Read down the column for df (numerator) = 1 and along the row of df (denominator) = 8 in the F-distribution table in the book (Section A.4). You should find that the critical value for a p = 0.05 is 5.32. The value of F that we observed was , which is smaller than the critical value of 5.32, suggesting that there is not a significant relationship between how ideal you rate your partner to be and your willingness to entertain other relationships.
Use the values in puzzle 5 to calculate R2. What does R2 represent, and how would you interpret the value for this specific model?
R2 represents the amount of variance in the outcome accounted for by the model (SSM) relative to how much variation there was to explain in the first place (SST). We have already calculated SSM and SST in puzzle 5, so we can plug these values into the equation for R2:
Therefore, in the current example R2 is 0.247, which tells us that the degree to which your partner matches your ideal can account for 24.7% of the variation in how open you are to searching for alternative relationships. This value is quite high.
In Chapter 13 Celia tried to convince Zach that there wasn’t a meaningful relationship between how closely your partner matches your ideal and your willingness to entertain other relationships. She did this knowing that Alice closely matched Zach’s ideal. The model summarized in Output 14.10 (in the book and reproduced below) shows what happens when you build a model to predict openness to alternative relationships (Alternatives) from both how much your partner matches your ideal (Ideal), and also the benefits you see in your current relationship (Benefit). This model uses the data in Table 13.4 (in the book and reproduced in puzzle 1). How might Celia use this model to get Zach to consider a relationship with her instead of Alice?
Output 14.10 (reproduced)
The b-values tell us about the relationship between openness to alternative relationships and each predictor. For the variable Ideal, the b-value is positive (b = 0.122), indicating a positive relationship between Ideal and Alternatives. However, this predictor is not significant, t(8) = 0.34, p = 0.74, because the associated p-value is very much larger than 0.05. This variable, therefore, doesn’t help Celia much with convincing Zach he should consider an alternative relationship to Alice - especially as Celia seems to be very close to what Zach might consider his ideal woman (same taste in music, etc.).
For the variable Benefit, the b-value is negative (b = −0.950), indicating a negative relationship between Benefit and Alternatives, i.e., the more benefits you see in your current relationship the less likely you are to search for alternatives. This predictor is a significant predictor of openness to alternative relationships, t(8) = −3.033, p = 0.02. Celia could argue that since Alice had vanished without any warning, belittles him constantly, is obsessed with science, isn’t interested in his music anymore, and Zach has implied that he and Alice had been drifting apart, that there are not currently many benefits in his relationship with Alice. That being so, based on this model, he should be more open to alternative relationships such as with Celia.
Write out the model in puzzle 8. What value of Alternatives would you expect if someone had scored 6 on the variable Ideal, and 7 on Benefit?
With the b-values are taken from Output 14.10, the model is:
If someone had a score of 6 on Ideal and 7 on Benefit, then we can plug these values into the model and find that you’d expect to get a value of −0.03 for Alternatives. This predicted value illustrates the fact that models are approximations of reality. A value is −0.03 is ridiculous because the rating scale ranges from 0 to 10, so this score is impossible.
A Bayes factor version of the model in puzzle 8 is shown in Output 14.11 (in the book and reproduced below). What three models have been tested, and which one should we choose?
The output shows the Bayes factor when we include only Ideal as a predictor, only Rewards, or when we include both. Each model is compared to an ‘intercept only’ model; that is, a model with no predictors.
All of the models have Bayes factors above 1 (although barely when only Ideal is included), but the largest Bayes factor is for when only Rewards is included as a predictor (the evidence for the model is 10.15 times that of the null). Ideal and Rewards together have a reasonable effect (the evidence for the model is 3.94 times that of the null), but the effect of Ideal alone produces a Bayes factor of only 1.02 (the evidence for the model is only 1.02 times that of the null). Therefore, we would favour model 2, in which Rewards is the only predictor.
Bayes factor analysis
 Ideal : 1.018349 ±0.01%
 Rewards : 10.15071 ±0%
 Ideal + Rewards : 3.939688 ±0%
Bayes factor type: BFlinearModel, JZS
Output 14.11 (reproduced)