[R] Singularity in a regression?

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Feb 26 16:07:42 CET 2009


On 26-Feb-09 12:58:49, Bob Gotwals wrote:
> R friends,
> 
> In a matrix of 1s and 0s, I'm getting a singularity error.  Any helpful
> ideas?

>From the degress of freedom in your output, it seems you are fitting
10 binary variables to a total of 23 observations. In such circumstances,
it is not unlikely that the matrix of 0s and 1s representing the
binary variables would have at least 1 column which can be represented
as a linear combination of the others (which is what the "1 not defined
because of singularities" means). Get more data, or use fewer variables!
Or, also worth considering, check whether there are relationahips
"in the real world" between your 10 variables which would tend to
generate such linear dependence.

Ted.

> lm(formula = activity ~ metaF + metaCl + metaBr + metaI + metaMe +
>      paraF + paraCl + paraBr + paraI + paraMe)
> 
> Residuals:
>         Min         1Q     Median         3Q        Max
> -4.573e-01 -7.884e-02  3.469e-17  6.616e-02  2.427e-01
> 
> Coefficients: (1 not defined because of singularities)
>              Estimate Std. Error t value Pr(>|t|)
> (Intercept)   7.9173     0.1129  70.135  < 2e-16 ***
> metaF        -0.3973     0.2339  -1.698 0.115172
> metaCl            NA         NA      NA       NA
> metaBr        0.3454     0.1149   3.007 0.010929 *
> metaI         0.4827     0.2339   2.063 0.061404 .
> metaMe        0.3654     0.1149   3.181 0.007909 **
> paraF         0.7675     0.1449   5.298 0.000189 ***
> paraCl        0.3400     0.1449   2.347 0.036925 *
> paraBr        1.0200     0.1449   7.040 1.36e-05 ***
> paraI         1.3327     0.2339   5.697 9.96e-05 ***
> paraMe        1.2191     0.1573   7.751 5.19e-06 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> Residual standard error: 0.2049 on 12 degrees of freedom
> Multiple R-squared: 0.9257,   Adjusted R-squared: 0.8699
> F-statistic: 16.61 on 9 and 12 DF,  p-value: 1.811e-05
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Feb-09                                       Time: 15:07:40
------------------------------ XFMail ------------------------------




More information about the R-help mailing list