我有 50 个 R 脚本,我需要为所有这些脚本更改同一行。有没有办法同时使用“查找”和“替换”来完成所有这些操作,而不是一个一个?
非常感谢您对此的投入!
我正在进行逻辑回归,但由于某种原因它不起作用:
mod1<-glm(survive~reLDM2+yr+yr2+reLDM2:yr +reLDM2:yr2+NestAge0,
family=binomial(link=logexp(NSSH1$exposure)),
data=NSSH1, control = list(maxit = 50))
Run Code Online (Sandbox Code Playgroud)
当我使用较少的数据运行相同的模型时,它可以工作!但是使用完整的数据集,我收到错误和警告消息:
Error: inner loop 1; cannot correct step size
In addition: Warning messages:
1: step size truncated due to divergence
2: step size truncated due to divergence
Run Code Online (Sandbox Code Playgroud)
这是数据:https://www.dropbox.com/s/8ib8m1fh176556h/NSSH1.csv?dl = 0
用户定义链接函数的日志曝光链接功能,用于已知命运生存建模的glmer:
library(MASS)
logexp <- function(exposure = 1) {
linkfun <- function(mu) qlogis(mu^(1/exposure))
## FIXME: is there some trick we can play here to allow
## evaluation in the context of the 'data' argument? …Run Code Online (Sandbox Code Playgroud)