Skip to content

Cross Validation Example Error #2

@Nallelybp

Description

@Nallelybp

I tried to reproduce the example and I made the modification in the name of the list and I got the following error

Factoring method for vcov matrix set to 'auto' for mrk
Error: couldn't evaluate grouping factor random[[1]]$id within model frame: try adding grouping factor to data frame explicitly if possible

library(BGLR)
  library(lme4GS)

  #Example 1, wheat 
  data(wheat)
  X<-wheat.X
  Z<-scale(X,center=TRUE,scale=TRUE)
  G<-tcrossprod(Z)/ncol(Z)
  A<-wheat.A
  rownames(G)<-colnames(G)<-rownames(A)
  y<-wheat.Y[,1]

  #Predict 10/100 of records selected at random. 
  #The data were partitioned in 10 groups at random
  #and we predict individuals in group 2.

  fold<-2
  y_trn<-y[wheat.sets!=fold]
  y_tst<-y[wheat.sets==fold]

  #######################################################################################
  #Marker based prediction
  #######################################################################################

  random2<-list(mrk=list(K=G,id=names(y_trn)))
	
  out<-lmer_uvcov(y_trn,fixed="1",random=random2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions