- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法理解为什么收到此错误。我的两个变量都是数字且长度相同,当变量不相同时,我用NA调整数据。但是我仍然收到一个错误,我的响应变量超出范围
year <- c(1,2,3,4,5,6,7,8,9,10)
y <- c(19.36, 0, 0, 0.06, 0,0, 1.58, 2.37, 0,0)
x1 <- c(99.735835998,32.73874517,10.8545887,47.96341768,6.29940882,22.55498627,16.64656661,4.234896268,0.571722269,53.45872813)
months = c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
Drivers = c("P","T")
ModelName = paste0(Drivers[1],"_",Drivers[2])
ModelNumb = 2
for (s in 1:length(months))
{
station_summary = data.frame(matrix(NA,length(stations),3))
colnames(station_summary)=c("Station", "ModelName", "ModSelection")
month = months[s]
for (se in 1:length(stations))
{
station = stations[se]
table = read.csv(paste0("D:/BF_Factors/Regroup Drivers/All_Drivers_BF_P_T/",station,"/Table_",station,"_",month,".csv"),sep=",",header = T)
table = subset(table, select=c("Year","BF",Drivers))
table = table[1:50,]
# Clean the data according to the model used. Some years have been excluded because no data where available
table[is.na(table[,2]),3] = NA
table[is.na(table[,2]),4] = NA
table[is.na(table[,3]),2] = NA
table[is.na(table[,3]),4] = NA
table[is.na(table[,4]),2] = NA
table[is.na(table[,4]),3] = NA
if (length(which(table[,2]>0))>=5) # If at least 5 values are higher than 0
{
x1 = table$P #first Driver
x2 = table$T
mod.GA1 <- gamlss(y~x1,sigma.fo=~1,family=GA)
mod.GA2 <- gamlss(y~x1+x2,sigma.fo=~1,family=GA)
最佳答案
问题出在y变量的0值中。如果响应变量中为0,则无法使GAMLSS符合Gamma分布。
注意:示例中的代码不可复制,因此我无法理解在处理数据后,y变量是否仍为0。
关于gam - GAMLSS错误:响应变量超出范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51957993/
我想从 gamlss R 函数预测二元类概率/类标签,如何使用预测函数来获取它们? 我有以下示例代码 library(gamlss) X1 0.2& X2=="A",1,0) n 0.2 & X2==
我有一个 gamlss 模型,我想用它来做出新的 y 预测(和置信区间),以便可视化模型与真实数据的拟合程度。我想从随机预测值的新数据集(而不是原始数据)中进行预测,但我遇到了错误消息。下面是一些示例
我正在使用 gamlss 包中的示例代码来绘制百分位曲线: library(gamlss) data(abdom) lms(y,x , data=abdom, n.cyc=30) 它正在绘制自己的一组
我的 y 变量 (n=30,000) 分布有非常重的尾部(正面和负面),为此 fitDist GAMLSS函数选择 ST4 系列。 我尝试使用解释变量 x(pb 平滑)来评估基于 GAMLSS 的回归
上下文:tidyverse 和 dplyr 环境/工作流程。 我希望了解如何解决以下问题,这是我在尝试处理回归结果集合时遇到的问题。 这个最小的可重现显示了问题 mtcars %>% gamlss
我是一名优秀的程序员,十分优秀!