[R] error: optim(rho, n2ll.rho, method = method, control = control, beta = parm$beta, : initial value in 'vmmin' is not finite

Brandy Lee Aven baven at stanford.edu
Fri Jul 10 05:11:03 CEST 2009


I am trying to use the lnam autocorrelation model from the SNA package. I have it running for smaller adjacency matrices (<1,500) it works just fine but when my matrices are bigger 4000+. I get the error: 

> lnam1_01.adj<- lnam(data01$adopt,x01,ec2001.csr)
Error in optim(rho, n2ll.rho, method = method, control = control, beta = parm$beta,  : 
  initial value in 'vmmin' is not finite


I have looked at the lnam code and cant even figure out what vmmin is. 
Is there anyway around this? Am I doing something wrong? What makes me think that its about the size of the adjacency matrix is that I can run the same command on similar objects that are just smaller and it works fine. 

please help!

>sessionInfo()
R version 2.9.1 (2009-06-26) 
x86_64-pc-linux-gnu 

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] numDeriv_2009.2-1 sna_2.0-1        

loaded via a namespace (and not attached):
[1] tools_2.9.1

> class(data01$adopt) #This is the response vector y
[1] "integer"

>data01$adopt[1:10] # Its just a binary outcome for all vertices
[1] 0 0 0 0 0 0 0 0 0 0 ......until 4,003

> class(x01) #X01 is a matrix of my six covariates for all vertices                                      
[1] "matrix"

#here is the an example of the data
>x01[1:10,1:6]
	on01 indegree outdegree	between eigen numalters01
1	1	0	0	0	1	1
19	1	0	1	0	0	1
123	1	0	1	0	0	1
140	1	0	1	0	0	1
169	1	0	1	0	0	1
189	1	0	1	0	0	1
195	1	0	1	0	0	2
204	1	0	1	0	0	1
231	1	0	2	0	0	1
252	1	0	3	0	0	4

# this is the adjacency matrix (in Sparse matrix format) that causes the error. I have another that is 10,500 and does the same thing.
>dim(ec2001.csr) 
[1] 4003 4003

>class(ec2001.csr)
[1] "matrix.csr"
attr(,"package")
[1] "SparseM"

>ec2001.csr[1:10,1:10] #here is what it looks like
    1 19 123 140 169 189 195 204 231 252
1   1  0   0   0   0   0   0   0   0   0
19  0  0   0   1   0   0   0   0   0   0
123 0  0   0   0   0   0   0   0   0   0
140 0  0   0   0   0   0   0   0   0   0
169 0  0   0   0   0   0   0   0   0   0
189 0  0   1   0   0   0   0   0   0   0
195 0  0   0   0   0   0   0   0   0   0
204 0  0   0   0   0   0   0   0   0   0
231 0  0   0   0   0   0   0   0   0   0
252 0  0   0   0   0   0   0   0   0   0


#There are also no infinite values in the objects. 
>is.infinite(x01)
[1] FALSE ..... N

>is.infinite(data01$adopt)
[1] FALSE .....N

>is.infinite(ec2001.csr)
[1] FALSE




More information about the R-help mailing list