Hi, I have a weird issue that I'm not sure how to solve. I have a data .csv file with columns 'name', 'block', 'year', 'rep', and maturity date('mat'). On the same file is a column for larvae ('la') and another column for stem breakage ('sb'), which are the response data. Everything works great with the larvae reponse data, but get a error for running the stem breakage data...
I read that there are ways to correct by how the data is read in, but not sure where to start with this since the file is the same for data that works and for the data that doesn't.
Code:
e<-read.csv2("720_raw_blocking.csv",header=TRUE,sep=",")
library(data.table)
library(ggplot2)
library(jsonlite)
library(biometryassist)
library(asreml)
e$year <- as.factor(e$year)
e$name <- as.factor(e$name)
e$Block <- as.factor(e$Block)
e$rep <- as.factor(e$rep)
e$mat <- as.numeric(e$mat)
e$la_pro <- as.numeric(e$la_pro)
e$sb_pro <- as.numeric(e$sb_pro)
current.asr <- asreml (fixed = la_pro ~ name + year + mat, random = ~Block + rep + Block:rep,
data=e,
family=asr_binomial(link = "logit", dispersion = 1, total = 5),
na.action = na.method(x="include")
)
##or wih the response variale sb_pro if running for the sb data.
wald(current.asr)
pred.out <-multiple_comparisons(
current.asr,
classify = "name",
sig = 0.05,
int.type = "ci",
trans = NA,
offset = NA,
decimals = 2,
descending = TRUE,
plot = FALSE,
label_height = 0.1,
rotation = 0,
save = TRUE,
savename = "predicted_values_la2", #savename changes pending on the analysis
)
pred.out
##Output from when code from biometryassist is run ('pred.out <- multiple comparisions..") with the sb_pro response data (no error with the la_pro response data is used):
Binomial; Logit Mu=P=1/(1+exp(-XB)); V=Mu(1-Mu)/N
Note: The LogLik value is unsuitable for comparing GLM models
Deviance from GLM fit: 1812.25
Variance heterogenity factor (Deviance/df): 0.79
(assuming 2297 degrees of freedom)
Binomial; Logit Mu=P=1/(1+exp(-XB)); V=Mu(1-Mu)/N
Note: The LogLik value is unsuitable for comparing GLM models
Deviance from GLM fit: 1812.25
Variance heterogenity factor (Deviance/df): 0.79
(assuming 2297 degrees of freedom)
Calculating denominator DF
Binomial; Logit Mu=P=1/(1+exp(-XB)); V=Mu(1-Mu)/N
Note: The LogLik value is unsuitable for comparing GLM models
Deviance from GLM fit: 1812.25
Variance heterogenity factor (Deviance/df): 0.79
(assuming 2297 degrees of freedom)
Binomial; Logit Mu=P=1/(1+exp(-XB)); V=Mu(1-Mu)/N
Note: The LogLik value is unsuitable for comparing GLM models
Deviance from GLM fit: 1812.25
Variance heterogenity factor (Deviance/df): 0.79
(assuming 2297 degrees of freedom)
Calculating denominator DF
Error in levels<-
(*tmp*
, value = as.character(levels)) :
factor level [20] is duplicated
##More info on the raw data.
'data.frame': 6144 obs. of 6 variables:
$ year : Factor w/ 2 levels "2020","2021": 1 1 1 1 1 1 1 1 1 1 ...
$ rep : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
$ Block : Factor w/ 5 levels "1","2","3","4",..: 2 2 2 3 3 3 3 3 3 3 ...
$ name : Factor w/ 724 levels "FC004002B","FC029333",..: 1 2 3 4 5 6 7 8 9 10 ...
$ mat : num 104 102 104 98 100 98 108 108 107 105 ...
$ la_pro : num 0.6 0.4 0.8 1 0.2 1 0.4 0.4 0.4 0.8 ...
$ sb_pro : num 0.2 0.0667 0.36 0.12 0.04 ...
Thank you in advance for looking this over!