[R] grey colored lines and overwriting labels i qqplot2
Ista Zahn
izahn at psych.rochester.edu
Thu Jul 14 05:06:17 CEST 2011
Hi Sigrid,
On Wed, Jul 13, 2011 at 9:47 PM, Sigrid <s.stenerud at gmail.com> wrote:
> Great! Thank you, Brian.
>
> To answer your question about intercept and slopes, I got them from a
> covariance analysis that I had already conducted. It seems like I can not
> use the regressions command for the model that I used to get the intercepts
> and slopes. I guess 2 factors are the maximum.
Two _levels_ of a factor is the _minimum_ ! Otherwise it is a
constant, not a variable.
>
> + ddply(test, c("country","treatment"),
> + function(x) {
> + coef(lm(total~ treatment+ year+ country + treatment:year,
> x))
> + })
>
> Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
> contrasts can be applied only to factors with 2 or more levels
>
> Any way to get around this? How about getting back to the abline command?
ddply splits the data in the first argument by the second argument. So
you can read your first line as "for every level defined by the
combination of county and treatment, extract the linear coefficients
of total regressed onto county, year, treatment, and the treatment X
year interaction". The problem with this is that each subset only has
one level of country and one level of treatment (see the first part of
the description above). So these are now constants, and you can't
treat constants as variables in a linear model.
>
> Thank you.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/grey-colored-lines-and-overwriting-labels-i-qqplot2-tp3657119p3666473.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list