Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

model - Analyzing non-count data which is zero-inflated in R

I have data with continuous (not count) response data that I need to analyse. This data (see an extract of this data in the given reproducible data) has about 58% of the response variable (ShannonDiv) being zeros. If it was count data I was going to use zero-inflated/hurdle models. Is there an equivalent method that can handle such data. I have tried to read around but I am afraid I haven't managed.

df<-structure(list(SiteID = structure(c(27L, 28L, 28L, 28L, 29L, 
29L, 29L, 3L, 3L, 3L, 30L, 30L, 30L, 31L, 31L, 31L, 32L, 32L, 
32L, 33L, 33L, 33L, 34L, 34L, 34L, 35L, 35L, 35L, 9L, 9L, 9L, 
6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 4L), .Label = c("1", "2", 
"3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", 
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", 
"26", "27", "28", "29", "30", "31", "32", "33", "34", "35"), class = "factor"), 
    WindSpeed = c(1.7, 0.3, 2.1, 0.6, 0.8, 1.7, 0.3, 2.5, 3.4, 
    4.8, 0, 0, 1.2, 0.4, 2, 1.6, 2.6, 0.5, 1.4, 2.3, 4.1, 2.1, 
    0.3, 1.3, 0.7, 0, 1.2, 3.8, 0.1, 0.6, 0.8, 2.6, 0.2, 0.4, 
    1.5, NA, 0.1, 1.4, 1.6, 3.7, 2.6), Humidity = c(19.7, 10.2, 
    10.1, 21.1, 10.2, 8.3, 18.3, 11.2, 8.7, 18.3, 16.3, 12.7, 
    23.6, 20.4, 17.5, 40.4, 15.7, 14.5, 42.5, 10.1, 11.3, 32.5, 
    10.2, 12.5, 16.7, 16.6, 11.7, 31, 54.6, 48.3, 61.8, 49.2, 
    42.1, 63.3, 69.8, NA, 82.6, 65.2, 51.7, 69.2, 13.6), Temp = c(25.1, 
    34.7, 31.2, 24.6, 35, 31.9, 25, 26.3, 28.2, 24.1, 32.5, 34.5, 
    27, 30.3, 31, 25.7, 31.3, 33, 24.3, 29.9, 30.9, 22, 34, 30.3, 
    27, 33.6, 33.2, 23.8, 28.2, 33, 27, 28.7, 29, 27.1, 24.3, 
    NA, 21.7, 25.3, 30.4, 23.1, 26.4), ShannonDiv = c(0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.693147180559945, 0.693147180559945, 
    0.693147180559945, 0, 0, 0, 0, 0, 0, 0.934769897858279)), class = c("data.table", 
"data.frame"), row.names = c(NA, -41L), .internal.selfref = <pointer: 0x00000221ef9d1ef0>)

#if it was zero inflated models I would use

    sh <- mixed_model(ShannonDiv ~ Windspeed+Humidity+Temp, 
data = df,random = ~ 1|SiteID,  
family = zi.poisson(), zi_fixed = ~Windspeed+Humidity+Temp)
    
    summary(sh)
question from:https://stackoverflow.com/questions/65939542/analyzing-non-count-data-which-is-zero-inflated-in-r

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...