Displaying 2 results from an estimated 2 matches for "nran".
Did you mean:
cran
2006 Aug 24
2
Why are lagged correlations typically negative?
...58593 -0.49161602 0.03805543
> (T2<-c(T1[2:3],NA))
[1] -0.49161602 0.03805543 NA
> cor(T1,T2, use="complete")
[1] 1
###########
# More advanced simulation example
###########
> lags
function(nobs,nreps,rho=1){
OUT<-data.frame(NEG=rep(NA,nreps),COR=rep(NA,nreps))
nran<-nobs+1 #need to generate 1 more random number than there are
observations
for(i in 1:nreps){
V1<-rnorm(nran)
V2<-sqrt(1-rho^2)*rnorm(nran)+rho*V1
#print(cor(V1,V2))
V1<-V1[1:nran-1]
V2<-V2[2:nran]
OUT[i,1]<-ifelse(cor(V1,V2)<=0,1,0)...
2005 Aug 03
7
call fortran in R
...ly load the
compiled code.
Here is what I have done:
In the terminal this how I compiled my fortran code:
R CMD SHLIB ~/Desktop/Fortan_kmeans/kmeans3.f
There is the wrapper I have paste inside de kmeans3.f file:
c THIS IS THE WRAPPER
subroutine wrapper(n, p, nran, mat, ishort, w, z,
+ ntran, istand, k1, k2, iassign, iseed)
integer n,p,kmax
real*8 mat(n,p),sx(kmax,p),sx2(kmax,p),vect(p),
+ xbar(kmax,p),var(kmax,p),mean(p),coord(10)
real*8 D1,Dref,SSE,SSEref,Dvec(kmax),w(p),SST...