Displaying 3 results from an estimated 3 matches for "tdon2".
Did you mean:
tdon
2006 May 17
0
script S-plus -> R
Dear List,
I'm trying to transfer a script that uses S-plus functions for the
kernel and integration calculations to R. This it what it looks like in
S-plus:
qrm(cpt,don,ect,h,intctk,nbcol,nbl1,nbl2,nbl3,nlc,nlgn,overlap,Results,tdon,tdon1,tdon11,tdon2,tdon21)
don<-guiDisplayFileDialog()
import.data (DataFrame="tdon",FileName=don,FileType="EXCEL")
nbcol<-length(tdon[1,])
nlc<-matrix(0,1,nbcol)
for (i in 1:nbcol)
{nbl1<-tdon[,i]
nbl2<-nbl1[nbl1!="NA"]
nbl3<-numRows(nbl2)
nlc[,i]<-nbl3
ect<-c...
2006 Jun 02
1
doubt with integrate ()
...what.
The function to integrate was defined with a for loop first:
for (i in 1:(nbcol-1))
{tdon1<-tdon[,i]
tdon11<-subset(tdon1,tdon1!="NA")
fctk1<-function(x)
{density(tdon11, bandwidth=h[i], kernel="gaussian")$y}
for (j in (i+1):nbcol)
{tdon2<-tdon[,j]
tdon21<-subset(tdon2,tdon2!="NA")
fctk2<-function(x)
{density(tdon21,bandwidth=h[j],kernel="gaussian")$y}
diffctk<-function(x)
{abs(fctk1(x)-fctk2(x))}
}}
integrate(diffctk,-Inf,Inf,subdivisions=100)$integral ,
where:...
2006 Jul 11
0
script problem to obtain pairs of overlap values
...h
[1] 1.047 2.973 0.887 1.520 2.955
Here is the code:
for (i in 1:(nbcol-1)) # nbcol<-ncol(tdon)
{tdon1<-tdon[,i]
tdon11<- subset(tdon1,tdon1!="NA")
fctk1<-function(x)
{density (tdon11, bw=h[i], kernel="gaussian")$y}
for (j in (i+1):nbcol)
{tdon2<-tdon[,j]
tdon21<- subset(tdon2,tdon2!="NA")
fctk2<-function(x)
{density (tdon21, bw=h[j], kernel="gaussian")$y}
diffctk<-function(x)
{abs(fctk1(x)-fctk2(x))}
intctk<- approxfun (diffctk(x), rule=2)
int<- integrate(...