Perhaps the following will be instructive:

mymat = matrix(1:6,3,2)
p = 1
mymat[p]
[1] 1
mymat[p,]
[1] 1 4

When you index a matrix by a single subscript, it returns a
single element, corresponding to the columnwise vector representation
of the matrix.  I'm guessing you want to put the estimates into
the pth row (mymat[p,]) or pth column (mypat[,p]) of the matrix.

                                        - Phil Spector
                                         Statistical Computing Facility
                                         Department of Statistics
                                         UC Berkeley
                                         spec...@stat.berkeley.edu



On Thu, 16 Sep 2010, Halabi, Anan wrote:

Hi,
I write below code for simulation for weibull- estimating parameters by 
weibullMLE function,
Although I define metrix for the variables still I got this message: number of 
items to replace is not a multiple of replacement length
Any suggestion

est=matrix (NA, 2,2)
se=matrix (NA, 2,2)
for ( p in 1:2) {
+ sampleSize <- 20
+ shape.true <- 1.82
+ scale.true <- 987
+ sampWB <- urweibull(sampleSize, shape=shape.true, scale=scale.true, lb=0, 
ub=Inf)
+ sampWBmleWB <- weibullMLE(sampWB)
+ est[p]= sampWBmleWB$estimate
+ se [p]= sampWBmleWB$s
+ }
Warning messages:
1: In est[p] = sampWBmleWB$estimate :
 number of items to replace is not a multiple of replacement length
2: In se[p] = sampWBmleWB$s :
 number of items to replace is not a multiple of replacement length
3: In est[p] = sampWBmleWB$estimate :
 number of items to replace is not a multiple of replacement length
4: In se[p] = sampWBmleWB$s :
 number of items to replace is not a multiple of replacement length
est
        [,1] [,2]
[1,] 1.507558   NA
[2,] 1.525856   NA
se
         [,1] [,2]
[1,] 0.2513083   NA
[2,] 0.2709073   NA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to