i am trying to fit a linear model with both continuous covariates and factors. When fitted with the intercept term the first level of the factor is treated by R as intercept and the estimate of the effects of remaining levels(say i th level) are given as true estimate of i th level - estimate of 1st level.can any please help me? thanks in advance..... -- View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3301811p3301811.html Sent from the R help mailing list archive at Nabble.com.
I don't see any question here, other than "can you please help me". Since long-awaited esp package has still not been released, you're going to have to be more specific than that... Best, Ista On Fri, Feb 11, 2011 at 2:05 PM, ATANU <ata.sonu at gmail.com> wrote:> > i am trying to fit a linear model with both continuous covariates and > factors. When fitted with the intercept > term the first level of the factor is treated by R as intercept and the > estimate of the effects of remaining levels(say i th level) ?are given as > true estimate of i th level - estimate of 1st level.can any please help me? > thanks in advance..... > -- > View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3301811p3301811.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
i am trying to fit a linear model with both continuous covariates and factors. When fitted with the intercept term the first level of the factor is treated by R as intercept and the estimate of the effects of remaining levels(say i th level) are given as true estimate of i th level - estimate of 1st level. i want the estimates of coefficients of each level along with the intercept term(general effect).can anyone please help me? thanks in advance..... -- View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.html Sent from the R help mailing list archive at Nabble.com.
I already responded to your identical post yesterday, asking you to actually ask a question. "can you please help me?" is not enough. Best, Ista On Sat, Feb 12, 2011 at 5:57 AM, ATANU <ata.sonu at gmail.com> wrote:> > i am trying to fit a linear model with both continuous covariates and > factors. When fitted with the intercept > term the first level of the factor is treated by R as intercept and the > estimate of the effects of remaining levels(say i th level) ?are given as > true estimate of i th level - estimate of 1st level. i want the estimates of > coefficients of ?each level along with the intercept term(general > effect).can anyone please help me? > thanks in advance..... > -- > View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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
Well, I may have been too hasty there. Actually the question was slightly improved. I think you are looking for ?contr.sum Best, Ista On Sat, Feb 12, 2011 at 3:55 PM, Ista Zahn <izahn at psych.rochester.edu> wrote:> I already responded to your identical post yesterday, asking you to > actually ask a question. "can you please help me?" is not enough. > > Best, > Ista > > > On Sat, Feb 12, 2011 at 5:57 AM, ATANU <ata.sonu at gmail.com> wrote: >> >> i am trying to fit a linear model with both continuous covariates and >> factors. When fitted with the intercept >> term the first level of the factor is treated by R as intercept and the >> estimate of the effects of remaining levels(say i th level) ?are given as >> true estimate of i th level - estimate of 1st level. i want the estimates of >> coefficients of ?each level along with the intercept term(general >> effect).can anyone please help me? >> thanks in advance..... >> -- >> View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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 >-- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
See ?contrasts and ?contr.sum By default, R uses contr.treatment, you want contr.sum Christophe On Sat, Feb 12, 2011 at 6:57 AM, ATANU <ata.sonu at gmail.com> wrote:> > i am trying to fit a linear model with both continuous covariates and > factors. When fitted with the intercept > term the first level of the factor is treated by R as intercept and the > estimate of the effects of remaining levels(say i th level) ?are given as > true estimate of i th level - estimate of 1st level. i want the estimates of > coefficients of ?each level along with the intercept term(general > effect).can anyone please help me? > thanks in advance..... > -- > View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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. >-- Christophe Pallier? <christophe at pallier.org> tel: +33 (0)1 69 08 79 34 Unit? de Neuroimagerie Cognitive INSERM-CEA, Neurospin center, F91191 Gif-sur-Yvette, France web site: http://www.unicog.org personal web site: www.pallier.org
On Feb 12, 2011, at 11:16 AM, Ista Zahn wrote:> Well, I may have been too hasty there. Actually the question was > slightly improved. I think you are looking for ?contr.sum >Another issue will arise besides what the switch of the contrasts -- The intercept is not a "general effect" but rather a combined intercept for all of the continuous terms estimated when they are simultaneous zero. (Only in the situation where the continuous variables had all been centered would this be anywhere near the "general effect" or "grand mean". ) I infer that OP has been brought up in an anova tradition and has not made a proper transition to regression. Perhaps what could be explored is whether the predict() function is a path to enlightenment or at least partial satisfaction. ?predict OP: Try something along these lines with the names for the factor variables matching that of the original data and choosing a representative value or values for the continuous variables: predict(mdl, data.frame(lev1=factor(val1,val2,val3, levels=levels(dat $lev1)), lev2= ... etc etc=etc ), contin=median(dat$contin) ) ) Perhaps with expand.grid() if combinations are needed. -- david. .... er, David.> Best, > Ista > > On Sat, Feb 12, 2011 at 3:55 PM, Ista Zahn > <izahn at psych.rochester.edu> wrote: >> I already responded to your identical post yesterday, asking you to >> actually ask a question. "can you please help me?" is not enough. >> >> Best, >> Ista >> >> >> On Sat, Feb 12, 2011 at 5:57 AM, ATANU <ata.sonu at gmail.com> wrote: >>> >>> i am trying to fit a linear model with both continuous covariates >>> and >>> factors. When fitted with the intercept >>> term the first level of the factor is treated by R as intercept >>> and the >>> estimate of the effects of remaining levels(say i th level) are >>> given as >>> true estimate of i th level - estimate of 1st level. i want the >>> estimates of >>> coefficients of each level along with the intercept term(general >>> effect).can anyone please help me? >>> thanks in advance..... >>> -- >>> View this message in context: http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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 >> > > > > -- > Ista Zahn > Graduate student > University of Rochester > Department of Clinical and Social Psychology > http://yourpsyche.org > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT