search for: aehan3616

Displaying 12 results from an estimated 12 matches for "aehan3616".

2012 Oct 22
4
creating a function using for if
Hi all, I'm trying to create a function where it can process a vector and also give a vector output accordingly #input: a,b anc c are constants, data is the vector #set the function fun<-function(a,b,c,data) { N=as.vector() for (i in min(data):max(data)){ if(i>c){ N<-(a*(i-c)^0.5)+(b*(i-c))} else {N<-0}} return(N) } #try dummy data=c(100,210,320,130,170,120,220,90,55,45)
2012 Oct 16
4
how to extract from list
Hi all, I have a list of 20000 data, and the list look like below. I wonder what is the simplest way to extract 'kappa' value (or 'xi' or 'alpha' for the matter) from each of the data. How can I simply code it without having to change the list to a dataframe first? Many thanks! $X19997 xi alpha kappa 784.7718640 165.4065141 -0.2709599 $X19998
2012 Oct 17
3
z.test for dataframe
Hi! I'm trying to use sapply to my dataframe for z.test function (teaching demos package) Sep=cbind(kIp,k02p,k04p,k07p) Sep=as.data.frame(Sep) kzt=sapply(Sep, function(m) z.test(m,sd(m))) Error in z.test(m, sd(Sep)) : You must specify a Standard Deviation of the population kzt=sapply(Sep, function(m) z.test(m,sd(Sep))) Error in z.test(m, sd(Sep)) : You must specify a Standard Deviation
2012 Nov 01
3
convert list without same component length to matrix
Hi, I have this lame question. I want to convert a list (each with varies in length) to matrix with same row length by eliminating vectors outside the needed range. For example: l<-list(NULL) l[[1]]=1,2,3.7 l[[2]]=3,4,5,6,3 l[[3]]=4,2,5,7 l[[4]]=2,4,6,3,2 l[[5]]=3,5,7,2 #so say I want to only have 4 rows and 5 column in my matrix (or data.frame) and eliminating the 5th index value in l[[2]]
2012 Jun 15
1
Replication of linear model/autoregressive model
Hi, I would like to make a replication of 10 of a linear, first order Autoregressive function, with respect to the replication of its innovation, e. for example: #where e is a random variables of innovation (from GEV distribution-that explains the rgev) #by using the arima.sim model from TSA package, I try to produce Y replicates, with respect to every replicates of e, #means for e[,1], I want
2012 Jul 03
1
integral with error:non-finite function value
Hi guys, I'm trying to use the the integral function to estimate the area under a PDF and a crossing curve. first I stated the function with several vectors in it: fn=function(a,b,F,mu,alpha,xi) { x<-vector() fs<-function(x) { c <- (mu+(alpha*(1-(1-F)^xi)/xi)) tmp <- (1 + (xi * (x - mu))/alpha) ((as.numeric(tmp > 0) * (tmp^(-1/xi - 1) *
2012 Aug 08
1
GEV distribution fitted by L-moment graph
Hi, I have been having difficulties in finding packages/ codes that simplify plotting of a GEV fitted to dataset (by L-moments) that would print out graph comprising dataset versus gumbel reduced variate n return period at the same. Anyone can help me on this? Thanks. [[alternative HTML version deleted]]
2013 Mar 13
1
merging a dataframe or vectors
Hi, I would like to know what is the easiest way to compile two or more set of vectors or data frame, according to their index. They are interrelated to one another by their assigned index. for example: #data set 1 abc #output: X403 X408 X410 X415 X418 X419 X420 X423 X424 X425 X426 X427 549.58 541.91 544.18 549.37 555.54 540.83 543.26 544.26 546.85 548.98 553.10 556.49
2012 Jun 20
2
lmomco in gev estimation
Hi guys, I'm trying to use lmomco package. first I did the manual calculation on what is the estimates scale and location parameter given L-CV=0.2, L1=1000 L-moments and k (shape parameter) =- 0.1. so what i get is: location: 821.0445 scale: 260.7590 shape: -0.1000 #I assign this as GEV vectors using vec2par GEVpara2<-vec2par(c( 821.0445 , 260.7590 ,-0.1),'gev') #then I
2012 Oct 23
2
vector indexing
Hi, I got a small problem on how to define the vector index without manually inspect the vector. example: y=c(2,3,5,2,4,6,8,3,6,2,5) #I have ten set of this kind of vectors (with different values but same length) that I would also like to run the routine below #say; v=the first index in y where the value is larger than 4, in this case index 3, value 5 #what I would like to do is take y[1:v]
2012 Jun 27
2
how to apply the same function to multiple data set
Hi R-users, I'm trying to repeat the same procedure to 1000 data set. I know this is very easy, but I got stuck finding the right and fastest way in running it. IID50=Riidf[1:50,1:1000] #where IID50 is a dataframe consist of 1000 time series(as column) and 50 time scales (row). #what I tried to do: estIID50=rep(NA,1000) for (i in 1:1000) estIID50[i]=pargev(lmom.ub(IID50[1:50,i])) #warning
2012 Sep 25
1
how to pass a function to a function inside a function
Hi, I'm trying to compile two functions into one function. the first funtion is called 'fs' which is self-made function, another function is from the built-in 'integration' function that is copy-paste-edited. If built separatey, these functions work well. However that is not the case if combines together, where certainly I made mistake somewhere when constructing the code.