Hello,
I'm wondering if there is any way to specify nesting a variable within a factor in RMark models?
Thanks!
			
		> f=c("red","blue","black")
> v=3:1
> df=data.frame(f=f,v=v)
> model.matrix(~v:f,df)
  (Intercept) v:fblack v:fblue v:fred
1           1        0       0      3
2           1        0       2      0
3           1        1       0      0
attr(,"assign")
[1] 0 1 1 1
attr(,"contrasts")
attr(,"contrasts")$f
[1] "contr.treatment"
> model.matrix(~v*f,df)
  (Intercept) v fblue fred v:fblue v:fred
1           1 3     0    1       0      3
2           1 2     1    0       2      0
3           1 1     0    0       0      0
attr(,"assign")
[1] 0 1 2 2 3 3
attr(,"contrasts")
attr(,"contrasts")$f
[1] "contr.treatment"
Users browsing this forum: No registered users and 0 guests