[R] A question about for loop

2017-08-17 Thread Moohwan Kim
Dear R users, I have the following codes: zeta <- rep(1,8) n <- 7 for (i in 1:2){ beta <- zeta[1:n+(i-1)*(n+1)] print(beta) parm <- zeta[i*(n+1)] print(parm) } ### The output is as follows: [1] 1 1 1 1 1 1 1 [1] 1 [1] NA NA NA NA NA NA NA [1] NA ### The outcome

[R] double integral calculation

2011-06-18 Thread Moohwan Kim
a=[0.1,0.2,0.1,0.3,0.4] b=[0.2,0.3,0.1,0.2,0.5] c=[1,1,1,1,1] log(c+a-x*b) where x=unknown scale variable. int=$$log(c+a-x*b)dadb, where $ denotes integral sign. Actually, how could I calculate the integral's approximation? double summation? best, moohwan

[R] How to include a few selected AR terms

2011-01-30 Thread Moohwan Kim
Dear R family, I have a quick question. m3=arima(zt,order=c(6,0,2)) % fit an ARIMA(6,0,2) model to zt. This equation contains all 6 AR terms plus 1 MA term. I want to include only AR(2) and MA(1) excluding the other terms. How could I accomplish it? best, moohwan

[R] Estimate an initial value for the level series from a return series

2010-08-03 Thread Moohwan Kim
values because there are two series. My question is as follow: Given the filtered log return series, is there a reasonable way to estimate an initial value for the price series? Best regards moohwan kim __ R-help@r-project.org mailing list https

[R] Question about allocMatrix error message

2010-07-21 Thread Moohwan Kim
Dear R family, I faced a technical problem in r coding. #s=t(dev)%*%dev/(nr-1) # dev (100,000 by 2) stands for deviation from the mean #sinv=solve(s) #t2=diag(dev%*%sinv%*%t(dev)) I got an error message at t2 statement: Error in diag(dev %*% si %*% t(dev)) : allocMatrix: too many

[R] To detect the location of duplicate values

2010-07-05 Thread Moohwan Kim
Dear R family, I have a question about how to detect some duplicate numeric observations. Suppose that I have two variables dataset. order value 1 0.52 2 0.23 3 0.43 4 0.21 5 0.32 6 0.32 7 0.32 8 0.32 9 0.32 10 0.12 11 0.46 12 0.09 13 0.32 14 0.25 ; Could you help me indicate where the

[R] to remove duplicate values

2010-07-05 Thread Moohwan Kim
Dear R family, Suppose I have two series. order value 1 0.52 2 0.23 3 0.43 4 0.21 5 0.32 6 0.32 7 0.32 8 0.32 9 0.32 10 0.12 11 0.46 12 0.09 13 0.32 14 0.25 For these two series, I figured out the way to detect the locations of duplicate values. The next thing to do is remove the

[R] Convolution vector to be derived

2010-06-04 Thread Moohwan Kim
I want to generate the following outcome using convolution of two sequences. x - c(1,2,3,4,5) y - c(6,7,8,9) The resulting convolution vector is 6 19 40 70 100 94 76 45 When using convolve(), it is hard to produce the result above. Would you help me out to get that? Best regards Moohwan Kim

[R] Convolution vector to be derived

2010-06-04 Thread Moohwan Kim
regards Moohwan Kim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] How to interpret a result based on wmtsa

2010-05-29 Thread Moohwan Kim
Dear R family I have a question as to how to get an answer I want to derive with the outcome from R-package, wmtsa. My concern is that I want to decide equivalent degrees of freedom (EDOF) based on the following outcome. library(wmtsa) W - wavMODWT(X, wavelet=s8) z1 - wavEDOF(W) print(z1)

[R] how to pick equivalent degrees of freedom in a R package wmtsa

2010-05-26 Thread Moohwan Kim
Dear R family I have a question as to how to get an answer I want to derive with the outcome from R-package, wmtsa. My concern is that I want to decide equivalent degrees of freedom (EDOF) based on the following outcome. library(wmtsa) W - wavMODWT(X, wavelet=s8) z1 - wavEDOF(W) print(z1)

[R] To correct an error message

2010-05-17 Thread Moohwan Kim
call (arg 1) I guess there are a few big negative numbers in lnabsdif_transaud. I was wondering if there is an appropriate way to truncate those numbers in a reasonable way. Regards, Moohwan Kim __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] How to manage an error message about NA/NaN/Inf

2010-05-16 Thread Moohwan Kim
call (arg 1) I guess there are a few big negative numbers in lnabsdif_transaud. I was wondering if there is an appropriate way to truncate those numbers in a reasonable way. Regards, Moohwan Kim __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] Singularity problem

2010-01-08 Thread Moohwan Kim
Dear R family I have a problem with invertibility in a matrix. m1 - ar(x, method='mle') Error in solve.default(res$hessian * length(x)) : Lapack routine dgesv: system is exactly singular How could I avoid this problem? Best Moohwan __

[R] to remove an error with log(zero)

2009-12-17 Thread Moohwan Kim
Dear R family I have an arbitrary column vector. 1 2 4 0 7 5 0 0 0 9 11 12 When I attempt to take natural logarithm of the series, as you guess there is an error message. To overcome this problem, my idea is to replace a zero or zeros in a row with appropriate numbers. In order to implement it, I

[R] too large dimension problem

2009-12-12 Thread Moohwan Kim
Dear R family When I run the command below, the error message came up. It seems like the problem is about computer capacity. It would be appreciated if anyone could give me a solution. ### N - 415884 tau - diag(1, N)[c(N, 1:(N - 1)),] Error in array(0, c(n, p)) : 'dim' specifies too

[R] how to creat a matrix

2009-12-11 Thread Moohwan Kim
Dear R family I am attempting to create a matrix. e.g., 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 How could I write a R program? Later I want to extend it to a N by N case. Thanks in advance best Moohwan __

[R] How could I find the inverse of a matrix?

2009-12-11 Thread Moohwan Kim
. Thanks in advance Best regards Moohwan Kim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] How to calculte the power of a matrix

2009-12-11 Thread Moohwan Kim
Dear R family I have a following question. Suppose I have a matrix as follows, for instance: tau= 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 I want to calculate (-m) power of tau, for example, m=893. When I run tau^2, the outcome is just tau. Any help would be appreciated.