[R] fit linear regression with multiple predictor and constrained intercept
robert.ptacnik at niva.no
robert.ptacnik at niva.no
Wed Nov 28 10:57:28 CET 2007
Hi group,
I have this type of data
x(predictor), y(response), factor (grouping x into many groups, with 6-20
obs/group)
I want to fit a linear regression with one common intercept. 'factor'
should only modify the slopes, not the intercept. The intercept is expected
to be >0.
If I use
y~ x + factor, I get a different intercept for each factor level, but one
slope only
if I use
y~ x * factor, I get the interaction term I want, but the intercept is not
kept constant.
Also, if I constrain teh intercept in the regression model (y~a+x*factor),
I get estimates both for slope and intercept of each factor level.
Robert
----------------------------------------------------------------------------------------------------------------------
NIVAs hovedkontor har flyttet til nye lokaler i CIENS - Forskningssenter
for miljø og samfunn; Gaustadalléen 21, 0349 Oslo. Meld deg på vårt
nyhetsbrev på www.niva.no
More information about the R-help
mailing list