楼主: xiefuzuo
1809 3

请R/s-plus高手帮忙看看我的程序哪里错误了呀,急,先谢了啊 [推广有奖]

  • 0关注
  • 1粉丝

已卖:304份资源

本科生

62%

还不是VIP/贵宾

-

威望
0
论坛币
527 个
通用积分
0.4200
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
920 点
帖子
29
精华
0
在线时间
140 小时
注册时间
2007-9-3
最后登录
2021-1-20

楼主
xiefuzuo 发表于 2009-10-22 09:07:55 |AI写论文
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
关键词:PLUS Plu 程序 高手 帮忙

本帖被以下文库推荐

沙发
ss229 发表于 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)
已有 1 人评分论坛币 收起 理由
crystal8832 + 10 热心帮助其他会员

总评分: 论坛币 + 10   查看全部评分

藤椅
xiefuzuo 发表于 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

板凳
xiefuzuo 发表于 2009-10-22 17:55:18
救命啊!!!S-Plus有没有方法呀?

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 04:04