由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 关于R的Simplex的错误信息
相关主题
突然对直线拟合的R不明白起来了R: load data 帮忙看看是什么问题
R question如何把model fitting statistics 读出来(R)
请教:关于covariance matrix为什么不能把ABLINE加到散点图中了
求用R做bootstrap的example script真心请教各位统计高手一个关联序列生成问题
能帮忙化简一个矩阵乘法么?R:matrix
求问一个R apply 函数的问题这个R程序能帮改进一下吗?
求教一道google的面试题,关于multicollinearity的为什么R里用optim里的Nelder--Mead simplex给convergence=10?
R 扫描matrix在R中, 如何实现没有duplicate的rbind?
相关话题的讨论汇总
话题: simplex话题: m2话题: m1话题: true话题: enj
进入Statistics版参与讨论
1 (共1页)
s********n
发帖数: 5
1
有一个线性规划问题,想用Simplex解决,未知数X为47维
enj是47维向量,M1和M2均为1000*48维矩阵,
运行下列语句的时候
simplex(a=enj,A1=M1[,2:48],b1=t(M1[,1]),A2=M2[,2:48],b2=t(M2[,1]),maxi=TRUE)
提示错误如下
Error in as.vector(X) %*% t(as.vector(Y)) : non-conformable arguments
取消了b1和b2的转置提示同样的错误
请问有人知道是哪里写错了么,谢谢
t**i
发帖数: 688
2
enj = rnorm(3, mean=3,sd=1)
M1 = matrix(rnorm(40,mean=0,sd=1),ncol=4,byrow=TRUE)
M2 = matrix(rnorm(40,mean=0,sd=1),ncol=4,byrow=TRUE)
require(boot)
simplex(a=enj,A1=M1[,2:4],b1=t(M1[,1]),A2=M2[,2:4],b2=t(M2[,1]),maxi=TRUE)
Linear Programming Results
Call : simplex(a = enj, A1 = M1[, 2:4], b1 = t(M1[, 1]), A2 = M2[, 2:4],
b2 = t(M2[, 1]), maxi = TRUE)
Maximization Problem with Objective Function Coefficients
x1 x2 x3
2.088811 4.114023 2.513823
No feasible solution could be f
t**i
发帖数: 688
3
Check your data objects and make sure they are vectors and matrices,
respectively. Also check their lengths/dimensions.
Useful commands:
class()
dim()
length()
s********n
发帖数: 5
4
谢谢Tosi地回答,这个问题已经解决了。我原来读入的是data.frame,需要转化成
matrix.
现在遇到一个新的问题,
Error in while (!all(obfun > -eps) && (it <= n.iter)) { :
missing value where TRUE/FALSE needed
有朋友知道可能是哪里的问题么,谢谢先
t**i
发帖数: 688
5
I am not familiar with simplex(), but this error seems to stem from
iteration/convergence criteria. Either obfun> -eps or it<=n.iter gives a NA
and that caused the problem. Try to play with eps or n.iter options.
However, caution is needed because the thus-generated results may not have
been drawn from the convergence status.
1 (共1页)
进入Statistics版参与讨论
相关主题
在R中, 如何实现没有duplicate的rbind?能帮忙化简一个矩阵乘法么?
请教几个logistic regression model的问题求问一个R apply 函数的问题
Re: reliability coefficient and its CI求教一道google的面试题,关于multicollinearity的
R help!!!R 扫描matrix
突然对直线拟合的R不明白起来了R: load data 帮忙看看是什么问题
R question如何把model fitting statistics 读出来(R)
请教:关于covariance matrix为什么不能把ABLINE加到散点图中了
求用R做bootstrap的example script真心请教各位统计高手一个关联序列生成问题
相关话题的讨论汇总
话题: simplex话题: m2话题: m1话题: true话题: enj