this question has answer here:
i working on project weights screws.
i looped through , found fits number of combinations shown below.
head style measurement intercept slope 1 x 1.0 2 x 2.2 3 x 4.1 b 1 x 1.2 b 2 x 2.0 b 3 x 4.1
if know fact ones same measurement should have same slope. a-1 should have same slope b-1. there way run lm set slopes set number?
it's still not entirely clear you're asking, let's suppose original data looks this:
head_style measurement x y 1 . . 1 . . 1 . . 2 . . ... b 1 . .
so you've done far fit separate models (with y~x
) each combination of measurement
, head_style
. suppose want slope depend on measurement
, intercept depend on both measurement
, head_slope
.
first, make sure measurement
factor
my_dat <- transform(my_dat,measurement=factor(measurement))
now fit single lm
model:
lm(y~head_style:measurement + measurement:x, data=my_data)
this should give separate intercept each combination of head_style
, measurement
, different slope each value of measurement
.
Comments
Post a Comment