1

For my PhD I am currently running a bivariate variance component estimation in AS Reml R with the following command:

Test <- asreml(cbind(Reflex,lakt_1) ~ trait + Betriebsnummer + 
    at(trait,1):gestLength + at(trait,1):halfyear,
  random= ~us(trait):vm(SampleID,Gs),
  residual= ~units:diag(trait),
  data= phenW,
  workspace= 128e06)

but every time I try to run it i get the following error message:

Error in levels <- (*tmp*, value = as.character(levels)) : factor level [4] is duplicated

My fixed factors (Betriebsnummer, gestLength and halfyear) are all defined as factors and I also set their attribute to "unique". I also did that with my random term, SampleID is a factor and Gs my genetic relationship matrix. phenW is my data set, it is a data frame. Reflex and lakt_1 are my response variables.

Is anybody able to help me?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • 1
    HI Helen, it would be great if you provide a sample of your input data and what you expect as a result. Check https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for more guidance. – Chriss Paul Mar 20 '21 at 16:14
  • 2
    It sounds like you have a complicated set of inputs, so making the example reproducible will be hard. Try simplifying it as much as possible by leaving out terms one by one. The model doesn't need to make sense, it just needs to generate the error message. Once you've got it really minimal, you can put inputs here and we'd be able to help. (The inputs don't need to be real either, as long as they generate the error....) – user2554330 Mar 20 '21 at 17:06
  • Ok thanks a lot! I already tried to leave out the fixation of my response variables and that didn't help... I try the rest tomorrow, for today i gave up :) – Helen Schneider Mar 20 '21 at 19:46

0 Answers0