全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1836 2
2017-02-13
程序如下:
> curwd = setwd("D:/R/work")
> df <- read.csv('activedata.csv',header = TRUE)
> dataDF <- df[,2:4]
> names(dataDF) <- c("counts","timelength","totallength")
> head(dataDF)
  counts timelength totallength
1     39          2          17
2     18          1          17
3     90         15          17
4     26          2          17
5     34          7          17
6    148         15          17
> attach(dataDF)
> x <- counts
> t <- timelength
> T <- totallength
> library(maxLik)
载入需要的程辑包:miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
> LL <- function(para,x,t,T)
+ {r <- para[1]
+ s <- para[2]
+ a <- para[3]
+ b <- para[4]
+
+ logL <- log(gamma(r+x))-log(gamma(r))+r*log(s)+log(gamma(a+b))+log(gamma(b+x))-log(gamma(para[4]))-log(gamma(a+b+x))
+ +log((s+q)^(-r-x)+(a/(b+x-1))*(s+t)^(-r-x))
+ return(logL)       
+ }
> result <- maxLik(LL,grad = NULL,hess = NULL)
Error in checkFuncArgs(fn, argNames, "fn", "maxNR") :
  argument 't' of the function specified in argument 'fn' of function 'maxNR' (partially) matches the argument names of function 'maxNR'. Please change the name of this argument
这是什么原因,是我的数据格式有问题吗

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2017-2-17 14:45:24
变量名重复了吧,改个名称
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-2-21 11:04:15
统计初学 发表于 2017-2-17 14:45
变量名重复了吧,改个名称
你好大神,我在写论文,比较着急求出结果,方便留下你的联系方式吗qq或微信,万分感谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群