如果代码花费的时间太长,则补救措施永远不会给出结果
Remedies if code takes too long, never gives resuluts
已更新
这是我数据的原始结构:除人和activity外,所有变量都是解释变量,因变量是完成。
data.frame': 581755 obs. of 68 variables:
**$ activity : int 37033 37033 37033 37033 37033 37033 37033 37033 37033 37033 ...
$ people : int 5272 5272 5272 5272 5272 5272 5272 5272 5272 5272 ...
$ completion: num 0 0 0 0 0 0 0 0 0 0 ...
*$ active : int 0 2 2 2 2 2 2 2 2 2 ...
$ overdue : int 0 0 0 0 0 0 0 0 0 0 ...
$ wdsp : num 5.7 5.7 7.7 6.4 3.9 5.8 3.5 6.3 4.8 9.4 ...
$ rain : num 0 0 0 0 0 0 0 0 0 0 ...
$ UserCompletionRate: num [1:581755, 1] NaN -1.55 -1.55 -1.55 -1.55 ...
..- attr(*, "scaled:center")= num 0.462
..- attr(*, "scaled:scale")= num 0.298
$ DayofWeekSu : num 0 0 0 0 0 1 0 0 0 0 ...
$ DayofWeekMo : num 0 0 0 0 0 0 1 0 0 0 ...
$ DayofWeekTu : num 1 0 0 0 0 0 0 1 0 0 ...
$ DayofWeekWe : num 0 1 0 0 0 0 0 0 1 0 ...
$ DayofWeekTh : num 0 0 1 0 0 0 0 0 0 1 ...
$ DayofWeekFr : num 0 0 0 1 0 0 0 0 0 0 ...
$ MonthofYearJan : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearFeb : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearMar : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearApr : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearMay : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearJun : num 1 1 1 1 1 1 1 1 1 1 ...
$ MonthofYearJul : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearAug : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearSep : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearOct : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearNov : num 0 0 0 0 0 0 0 0 0 0 ...
$ cold : num 0 0 0 0 0 0 0 0 0 0 ...
$ hot : num 0 0 0 0 0 0 0 0 0 0 ...
$ overduetask : num 0 0 0 0 0 0 0 0 0 0 ...***
My data relates if activities from people are completed or not and
affected by sunshine and all other variables posted above -
completion
is the outcome variable and sunshine
would be the
explanatory variable; this is a simplified version.
df <- people = c(1,1,1,2,2,3,3,4,4,5,5),
activity = c(1,1,1,2,2,3,4,5,5,6,6),
completion = c(0,0,1,0,1,1,1,0,1,0,1),
sunshine = c(1,2,3,4,5,4,6,2,4,8,4)
到目前为止,我已将此代码用于木屐:
model<- as.formula("completion ~ sunshine")
clog_full = glm(model,data=df,family = binomial(link = cloglog))
summary(clog_full)
> using package glmmML
model_re<- as.formula("completion ~ sunshine")
> clog_re = glmmML(model_re,cluster = people, data= df,family =
> binomial(link = cloglog)) summary(clog_re)
>
> using package lme4
>
> model_re1<- as.formula("completion ~ (1|people) + sunshine") clog_re1
> = glmer(model_re1, data=df,family = binomial(link = cloglog)) summary(clog_re1) summ(clog_re1, exp = TRUE)
您显然没有发布挂起的代码,因为我们看到了这个:
df <- people = c(1,1,1,2,2,3,3,4,4,5,5),
Error: unexpected ',' in "df <- people = c(1,1,1,2,2,3,3,4,4,5,5),"
如果您需要一个数据帧,您首先需要输入缺少的 data.frame
调用:
df <- data.frame( people = c(1,1,1,2,2,3,3,4,4,5,5),
activity = c(1,1,1,2,2,3,4,5,5,6,6),
completion = c(0,0,1,0,1,1,1,0,1,0,1),
sunshine = c(1,2,3,4,5,4,6,2,4,8,4) )
如果您输入缺少的换行符,其余代码将毫无困难地运行:
library(lme4)
model_re1<- as.formula("completion ~ (1|people) + sunshine")
clog_re1 = glmer(model_re1, data=df,family = binomial(link = cloglog))
summary(clog_re1)
summ(clog_re1, exp = TRUE) # there is no function named `summ` so that throws an error but does not hang
library( glmmML)
model_re<- as.formula("completion ~ sunshine")
clog_re = glmmML(model_re,cluster = people, data= df,family =
binomial(link = cloglog))
summary(clog_re)
已更新
这是我数据的原始结构:除人和activity外,所有变量都是解释变量,因变量是完成。
data.frame': 581755 obs. of 68 variables:
**$ activity : int 37033 37033 37033 37033 37033 37033 37033 37033 37033 37033 ...
$ people : int 5272 5272 5272 5272 5272 5272 5272 5272 5272 5272 ...
$ completion: num 0 0 0 0 0 0 0 0 0 0 ...
*$ active : int 0 2 2 2 2 2 2 2 2 2 ...
$ overdue : int 0 0 0 0 0 0 0 0 0 0 ...
$ wdsp : num 5.7 5.7 7.7 6.4 3.9 5.8 3.5 6.3 4.8 9.4 ...
$ rain : num 0 0 0 0 0 0 0 0 0 0 ...
$ UserCompletionRate: num [1:581755, 1] NaN -1.55 -1.55 -1.55 -1.55 ...
..- attr(*, "scaled:center")= num 0.462
..- attr(*, "scaled:scale")= num 0.298
$ DayofWeekSu : num 0 0 0 0 0 1 0 0 0 0 ...
$ DayofWeekMo : num 0 0 0 0 0 0 1 0 0 0 ...
$ DayofWeekTu : num 1 0 0 0 0 0 0 1 0 0 ...
$ DayofWeekWe : num 0 1 0 0 0 0 0 0 1 0 ...
$ DayofWeekTh : num 0 0 1 0 0 0 0 0 0 1 ...
$ DayofWeekFr : num 0 0 0 1 0 0 0 0 0 0 ...
$ MonthofYearJan : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearFeb : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearMar : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearApr : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearMay : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearJun : num 1 1 1 1 1 1 1 1 1 1 ...
$ MonthofYearJul : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearAug : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearSep : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearOct : num 0 0 0 0 0 0 0 0 0 0 ...
$ MonthofYearNov : num 0 0 0 0 0 0 0 0 0 0 ...
$ cold : num 0 0 0 0 0 0 0 0 0 0 ...
$ hot : num 0 0 0 0 0 0 0 0 0 0 ...
$ overduetask : num 0 0 0 0 0 0 0 0 0 0 ...***
My data relates if activities from people are completed or not and affected by sunshine and all other variables posted above -
completion
is the outcome variable andsunshine
would be the explanatory variable; this is a simplified version.
df <- people = c(1,1,1,2,2,3,3,4,4,5,5),
activity = c(1,1,1,2,2,3,4,5,5,6,6),
completion = c(0,0,1,0,1,1,1,0,1,0,1),
sunshine = c(1,2,3,4,5,4,6,2,4,8,4)
到目前为止,我已将此代码用于木屐:
model<- as.formula("completion ~ sunshine")
clog_full = glm(model,data=df,family = binomial(link = cloglog))
summary(clog_full)
> using package glmmML
model_re<- as.formula("completion ~ sunshine")
> clog_re = glmmML(model_re,cluster = people, data= df,family =
> binomial(link = cloglog)) summary(clog_re)
>
> using package lme4
>
> model_re1<- as.formula("completion ~ (1|people) + sunshine") clog_re1
> = glmer(model_re1, data=df,family = binomial(link = cloglog)) summary(clog_re1) summ(clog_re1, exp = TRUE)
您显然没有发布挂起的代码,因为我们看到了这个:
df <- people = c(1,1,1,2,2,3,3,4,4,5,5),
Error: unexpected ',' in "df <- people = c(1,1,1,2,2,3,3,4,4,5,5),"
如果您需要一个数据帧,您首先需要输入缺少的 data.frame
调用:
df <- data.frame( people = c(1,1,1,2,2,3,3,4,4,5,5),
activity = c(1,1,1,2,2,3,4,5,5,6,6),
completion = c(0,0,1,0,1,1,1,0,1,0,1),
sunshine = c(1,2,3,4,5,4,6,2,4,8,4) )
如果您输入缺少的换行符,其余代码将毫无困难地运行:
library(lme4)
model_re1<- as.formula("completion ~ (1|people) + sunshine")
clog_re1 = glmer(model_re1, data=df,family = binomial(link = cloglog))
summary(clog_re1)
summ(clog_re1, exp = TRUE) # there is no function named `summ` so that throws an error but does not hang
library( glmmML)
model_re<- as.formula("completion ~ sunshine")
clog_re = glmmML(model_re,cluster = people, data= df,family =
binomial(link = cloglog))
summary(clog_re)