This is just a simplified version of what I have to do. I have to perform a linear mixed effects regression for the following model:
y~a1+F1+F2+(1|Effect1)+(1|Effect2)
The problem I have is coding the fixed effects.
F1=a2*(M-M1)+a4*(10-M) if M >=M1
=a3*(M-M2)+a4*(10-M1) if M < M1
F2=a5*ln(R+a6)+a7*lnV if V<100
=a5*1.5+a7 if V>=100
M,R,V,y,M1 & M2 are given and so are the Effects1 & Effects2. Also it is a large data set. I have to find the regression coefficients a1,a2,a3,a4,a5,a6,a7. Is there a way to do this in R?Like specifying the coefficients as variables or any other approach.
Edit: I have removed the F3 term and modified the F2 term, because it was causing a lot of confusion and I am mainly concerned about the first 2 terms