全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1761 3
2009-10-22
悬赏 10 个论坛币 已解决
QI0<-function(a) {
qnorm(a)
}
#1阶上分位数积分
QI1<-function(a){
integrate(QI0,lower=0, upper=a)
}
QI2<-function(a){
   integrate(QI1,lower=0, upper=0.05)
}
QI2(0.05)

出错:Warning messages:
1: Condition has 15 elements: only the first used in: e1 && e2
2: Condition has 15 elements: only the first used in: if(lower == upper) { ....
Problem in h * intervals: length of longer operand (15) should be a multiple of length of shorter (7)
Use traceback() to see the call stack

最佳答案

ss229 查看完整内容

原QI1函数不能计算形如QI1(c(0.5,0.6,0.7))的形式,而在QI2函数会用到的QI1(x),x为向量的计算形式,所以程序改为, QI0
二维码

扫码加我 拉你入群

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

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

全部回复
2009-10-22 09:07:56
原QI1函数不能计算形如QI1(c(0.5,0.6,0.7))的形式,而在QI2函数会用到的QI1(x),x为向量的计算形式,所以程序改为,

QI0<-function(a) {
qnorm(a)
}
#1阶上分位数积分
QI1<-function(a){
      n = length(a)
      result = 1:n
      for (i in 1:n){
           temp = integrate(QI0,lower=0, upper=a)
           result = temp$value
       }
      result
}
QI2<-function(a){
      result = integrate(QI1,lower=0, upper=a)
      rusult = result$value
}
QI2(0.5)
二维码

扫码加我 拉你入群

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

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

2009-10-22 17:50:37
兄弟,好像不行啊,下面这个小代码,谁帮我改改吧
e2<-function(a) integrate(function(x) x,lower=0,upper=a)$integral
integrate(e2,lower=0, upper=0.5)$integral
二维码

扫码加我 拉你入群

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

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

2009-10-22 17:55:18
救命啊!!!S-Plus有没有方法呀?
二维码

扫码加我 拉你入群

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

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

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

分享

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