Re: [R] R-help Digest, Vol 34, Issue 14
Guten Tag, Ich bin vom 12. bis 23. Dezember 2005 im Militär-WK. Ich werde die Mails somit nur verzögert beantworten können. Für dringende Fälle: Während diesen zwei Wochen bin ich via Natel (am besten per SMS) erreichbar unter der Nummer 079 438 27 68. Mit freundlichem Gruss Dominik Schaub __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problems with sending data to FORTRAN subrutine
Dear ExpeRts! I have problem with sending data to FORTRAN subroutine on Windows XP and R 2.1.1. When I call it using .Fortran, I get the following error: R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the inconvenience. Error signature AppName: rgui.exe AppVer: 2.11.50620.0 ModName: read.dll ModVer: 0.0.0.0 Offset: 1683 It seams that the error is somehow related to the size of the data. Here are the calls: dyn.load(C:/ales/b_for/read.dll) #The FORTRUN subroutine used to create the read.dll (read.f) is attached (and in case something happens to the attachment also at the end of the mail. n-as.integer(134);k-as.integer(2);M-matrix(as.double(rnorm(n=n^2)),nrow=n,ncol=n);.Fortran(read,M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #This works ok n-as.integer(134);k-as.integer(4);M-matrix(as.double(rnorm(n=n^2)),nrow=n,ncol=n);.Fortran(read,M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #Now the k is incrised form 2 to 4 and the error occours. n-as.integer(40);k-as.integer(4);M-matrix(as.double(rnorm(n=n^2)),nrow=n,ncol=n);.Fortran(read,M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #If I leave the k at 4 and reduce the n to 40, then it works. Any suggestions are welcomed. Thank you in advance! Best regards, Ales Ziberna The commands used to generate read.dll. g77 -c read.f R CMD SHLIB read.o The FORTRAN subroutine (read.f): subroutine read(M,n,clu,k,diag,err,E,BM) INTEGER n, clu, k, i, j, ii, nA, nAD DOUBLE PRECISION M, E, BM, A, AD, vecA, vecAD, err, mean, temp, ss LOGICAL diag DIMENSION M(n,n), clu(n), E(k,k), BM(k,k), A(k,k,n*n), AD(k,n), nA(k,k), nAD(k), vecA(n*n), vecAD(n) end __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] inervals() in nlme
I run e7.lmeb3 - lme(baLO ~ bar + factor( delta), data = e7, random = ~ 1 | sub, method = ML) then intervals(e7.lmeb3, which = fixed) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 1.1234926 1.5214930 1.9194933 bar -5.7844080 -5.2980375 -4.8116670 factor(delta)72 -0.4749977 -0.3405108 -0.2060240 factor(delta)76 -1.1222397 -0.9635469 -0.8048541 factor(delta)80 -1.5433094 -1.3509264 -1.1585434 factor(delta)84 -1.8461160 -1.6539038 -1.4616916 attr(,label) [1] Fixed effects: how can I get the CIs for the fixed effects in the 20 cells of the bar * delta design? Please send a cc to me when replying to the list. _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R-help: gls with correlation=corARMA
The error message is misleading. It should say something like, Error in corARMA(q = 25, value = -ma.coefs, fixed = T) : The moving average process specified is not invertible, having roots outside the unit circle. Instead it says, Error in corARMA(q = 25, value = -ma.coefs, fixed = T) : All parameters must be less than 1 in absolute value. I'm copying Doug Bates on this reply in case he wants to try to fix this. I got an answer just by shrinking your ma.coefs' by a factor of 0.8: mod.gls=gls(obs~model,correlation=corARMA(q=25,value=0.8*ma.coefs,fixed=T), method=ML) This seemed to produce an answer for me; it least it did not give me an error message. In case you are interested in how I determined this, I will outline the steps I took in analyzing this problem. First, I copied the web address you gave for the data into a web browser to make sure it was honest text and not something that might corrupt my computer. You are to be commended for providing an example that allowed me to replicate your problem. If the example had been smaller and simpler, it would have made my job easier and might have gotten you an earlier reply from someone else. Then I ran your code and got the error you reported: ... mod.gls=gls(obs~model, + correlation=corARMA(q=25,value=ma.coefs,fixed=T), + method=ML) Error in corARMA(q = 25, value = ma.coefs, fixed = T) : All parameters must be less than 1 in absolute value Next, I considered ways to simplify this problem and still get the same error message. I decided to try the corARMA part by itself: corARMA(q=25,value=ma.coefs,fixed=T) Error in corARMA(q = 25, value = ma.coefs, fixed = T) : All parameters must be less than 1 in absolute value Progress. Then I typed corARMA at a command prompt and copied the code into a scrit file. The I typed debug(corARMA) and repeated the corARMA(...) command. After tracing through the corARMA code line by line, I found that the error message is issued from '.C(ARMA_unconstCoef, ...)'. I gave that up: This approach did not help in this case, thoug it has in others. Then I tried some simpler examples: 'corARMA(q=1,value=.5,fixed=T)' and 'corARMA(q=1,value=-.5,fixed=T)' did NOT give me that error message, but 'corARMA(q=2,value=c(.8, -.5),fixed=T)' did. Then I checked a time series book for the conditions for invertibility. I found that all the roots of the characteristic equation must lie outside the unit circle. So I checked the following: round(Mod(polyroot(c(1, ma.coefs))), 3) [1] 1.069 0.995 0.995 0.995 0.995 0.995 0.995 0.995 0.995 1.069 1.069 1.069 [13] 0.995 0.995 0.995 0.995 1.069 1.069 1.069 1.069 1.069 1.069 1.069 1.069 [25] 1.930 Then I shrunk the ma.coefs' by 0.999 and got larger roots but still some inside the unit circle. So I tried 0.99 and 0.9 with the same result. With 0.8, all the roots were outside the unit circle. hope this helps. spencer graves [EMAIL PROTECTED] wrote: Dear Madams/Sirs, Hello. I am using the gls function to specify an arma correlation during estimation in my model. The parameter values which I am sending the corARMA function are from a previous fit using arima. I have had some success with the method, however in other cases I get the following error from gls: All parameters must be less than 1 in absolute value. None of the parameters (individually) are greater than or equal to 1. Please copy the code below into R to reproduce the error. Thanks. Is my logic incorrect? In the corARMA function, there's a call to pre-compiled C code with the name ARMA_unconstCoef. Is the source code for such compiled code freely available for download? Thanks for your suggestions. Sincerely Steve Gaffigan data=read.table(http://ak.aoos.org/data/sample_070989.dat,header=T) attach(data) mod.ols=lm(obs~model) mod.sma=arima(residuals(mod.ols),order=c(0,0,1),seasonal=list(order=c(0,0,2),period=12)) theta.1=mod.sma$coef[1] THETA.1=mod.sma$coef[2] THETA.2=mod.sma$coef[3] ma.coefs=c(-theta.1,double(10),-THETA.1,theta.1*THETA.1,double(10),-THETA.2,theta.1*THETA.2) library(nlme) mod.gls=gls(obs~model,correlation=corARMA(q=25,value=ma.coefs,fixed=T),method=ML) detach(data) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
Re: [R] Problem with indexing (subscript out of bounds)
Ferdinand Alimadhi wrote: There are two ways to index the matrices, using indexes of the row and columns or using names of rows and columns. In your example, it seems that you need to index your matrix by row names. X[rownames(X) %in% 17:19, ] could give the result you want. Thanks a lot, this did the trick! Regards, Nils __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html