[R] Singularity in a regression?
David Winsemius
dwinsemius at comcast.net
Thu Feb 26 16:25:36 CET 2009
I saw Ted's reply and it is certainly sensible. I would wonder whether
to model ought to be recast so that the scientific question is more
clear? You are obviously studying the effect of different
substitutions (F, Cl, Br, I, Me) and different positions around an
aromatic ring (meta, para). Why not consider the order of
electrophilicity (or possibly size) and the position as two different
variables, one ordered and the other binomial?
After recoding, your formula might then look like activity ~ electro
+ position ... or possibly activity ~ electro + size + position, and
you would be less likely to run into difficulties with collinearity.
You would also have some science in your model rather than casting
aimlessly about in the data. If your ordering is sensible, you end up
testing with 2 or 3 degrees of freedom.
--
David Winsemius
On Feb 26, 2009, at 7:58 AM, Bob Gotwals wrote:
> R friends,
>
> In a matrix of 1s and 0s, I'm getting a singularity error. Any
> helpful ideas?
>
> 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.
More information about the R-help
mailing list