[R] createDataPartition

2010-09-09 Thread Trafim Vanishek
= 10, p = .7, list = FALSE) Thanks a lot for your help. Regards, Trafim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

[R] minor diagonal in R

2010-09-07 Thread Trafim Vanishek
Dear all, seems that easy question but cannot find the function for that. How to get the elements of the minor diagonal of the matrix? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] lm prediction strange error

2010-08-16 Thread Trafim Vanishek
m(y ~ x, DF) > predict(m, data.frame(x = seq(-13, 13, 0.5))) > > > I hope it helps. > > Best, > Dimitris > > > > On 8/16/2010 2:37 PM, Trafim Vanishek wrote: > >> Dear all, >> >> I have an error in the simple prediction function for lm(). >> M

[R] lm prediction strange error

2010-08-16 Thread Trafim Vanishek
) Thanks a lot, Trafim [[alternative HTML version deleted]] __ 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, m

[R] Calculation optimization advice needed

2010-07-19 Thread Trafim Vanishek
Dear all, I produced a part of code which does what needed but by estimations I would need to wait for that for 300 hours!!! Maybe someone can give a me a glance advice or something. Thanks a lot! I need to define maximum adjusted R-squares from regression model: returns as dependent variable( he

[R] reverse string

2010-07-14 Thread Trafim Vanishek
Dear all, Are there any functions in R to reverse the order of the string. smth like reverse("abc") to get "cba"? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-h

Re: [R] strange floor rounding

2010-07-09 Thread Trafim Vanishek
Thanks everybody for referring me to FAQ 7.31 but I don't see how to solve it. I am giving a concrete number and I need to get 58 not 57. Seems, there is no way? On Fri, Jul 9, 2010 at 4:05 PM, David Winsemius wrote: > > On Jul 9, 2010, at 9:46 AM, Trafim Vanishek wrote: &g

[R] strange floor rounding

2010-07-09 Thread Trafim Vanishek
Dear all, might seem and easy question but I cannot figure it out. floor(100*(.58)) [1] 57 where is the trick here? And how can I end up with the right answer? Thanks a lot everybody for your help. Trafim [[alternative HTML version deleted

[R] Matrix elements are vectors

2010-04-05 Thread Trafim Vanishek
Dear all, My question how is it possible to define a matrix A with 10 rows 1 column, so that its elements are vectors of undefined length. I need to have a possibility later to add elements like A[1,1] <- c(A[1,1],3,4,5) Thanks a lot for the help! [[alternative HTML version deleted]] _

[R] nls function

2010-03-24 Thread Trafim Vanishek
Hi everybody, would like to ask if there is any possibility to get SOME BEST result for nls fitting if the function itself doesn't produce it. I already increased number of iterations, reduced minfactor and still it doesn't give me the solution. Thanks a lot. [[alternative HTML version d

[R] Fitting chi-squared distribution

2010-03-01 Thread Trafim Vanishek
Dear all, I have a question regarding performing test if the data fits chi-squared distribution. For example, using ks.test() I found in the examples how to fit it to gamma or weibull x<-rnorm(100) ks.test(x, "pweibull", shape=2,scale=1) for the gamma, pgamma can be used But I cannot find the v

[R] Shapiro-Wilk test problem

2010-02-18 Thread Trafim Vanishek
Hi everybody, Does anyone know what problem may be with this test. I am applying 5 different normality tests and use p-values for them, but for some reason S-W gives me NA, while sample size is 100. Any ideas? Thanks a lot! [[alternative HTML version deleted]] _

Re: [R] Integral of function of dnorm

2010-02-11 Thread Trafim Vanishek
This is exactly what I mean. I need to find integrate(dnorm(mean=8,sd=1)*log(dnorm(mean=8,sd=1)), -Inf, Inf) Which doesn't work like that, because it says: Error in dnorm(mean = 8, sd = 1) : element 1 is empty; the part of the args list of '.Internal' being evaluated was: (x, mean, sd, log)

[R] Integral of function of dnorm

2010-02-10 Thread Trafim Vanishek
Dear all, How is it possible in R to calculate the following integral: Integral(-Inf, Inf)[log(dnorm(mean = 3, sd = 1))] how can I define that the density dnorm is taken on (-Inf, Inf) Thanks a lot! [[alternative HTML version deleted]] __ R-h

[R] Extract p-value from lm for the whole model

2010-02-05 Thread Trafim Vanishek
Dear all, I would like to ask how to extract the p-value for the whole model from summary(lm). This didn't help a lot summary.lm summary(lm(speed~dist, cars)) Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] diagnostic plots

2010-02-04 Thread Trafim Vanishek
Thanks a lot everybody! I see how it works now. But now the other question: I would like to see the Cook's distance plot which is more understandable for me not the Residuals vs Leverage. The one it shows in the examples http://www.personality-project.org/r/r.lm.html But for some reason it doesn't

[R] diagnostic plots

2010-02-03 Thread Trafim Vanishek
Dear all, does anybody ever encountered the problem with diagnostic plots? x<-rnorm(100) y<-rnorm(100) plot(lm(x~y)) It gives the following message "Waiting to confirm page change..." and nothing happens. Thanks a lot! [[alternative HTML version deleted]] _

[R] Plot - specification for grid of x axis

2010-02-02 Thread Trafim Vanishek
Dear all, I have a simple question for which I cannot find the answer. I need to make an easy plot, but for the x axis I need to be able to specify by myself the division of x axis from x[,1] either every single observation, or every 5th, or 10th or 20th x <- matrix(data=NA, nrow=100, ncol=2) x[

[R] GARCH (1,1) negative volatility???

2010-01-27 Thread Trafim Vanishek
Dear all, I am using GARCH (1,1) model to simulate volatility. But seems that I am missing something about how it works in R. The following code produces negative results, though vola cannot be. What is wrong here? library("fSeries") library("fGarch") spec = garchSpec(model = list(omega = 0.01,

[R] Extract R-squared from summary of lm

2010-01-22 Thread Trafim Vanishek
Dear all, I cannot find to explicitly get the R-squared or adjusted R-squared from summary(lm()) Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do rea

[R] plot type any symbols?

2010-01-14 Thread Trafim Vanishek
Dear all, I have a question is there a possibility to plot points with different symbols like stars, crosses? I looked at different types for plot command and didn't find anything like that. Thanks a lot. [[alternative HTML version deleted]] _

[R] <= returns wrong result? Why

2010-01-12 Thread Trafim Vanishek
Dear all, Does anybody know the probable reason why <= gives false when it should give true? These two variables are of the same type, and everything works in the cycle but then it stops when they are equal. this is the output result > Rk[47] <= RB[21] [1] FALSE > Rk[47] [1] 0.002842007 > RB[21

[R] plot prices and dates in a nice way

2010-01-12 Thread Trafim Vanishek
Dear all, I currently experience the problem with nicely plotting price data against the dates. Data <- read.csv("C:/IBM.csv", header = TRUE, sep = ",") plot(Data[,1], Data[,2]) I cannot find the way how can I choose the # of breaks for the x axis - dates in this case? Thanks a lot _

[R] Fitting chi-squared distribution

2010-01-08 Thread Trafim Vanishek
Dear all, I would like to ask if there is a simple was in R to fit the chi-squared distribution to the empirical data? Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

[R] Graph titles from massive

2010-01-07 Thread Trafim Vanishek
Dear all, I would like to ask you if there is a possibility in R to give the names to graphs which are not const. For example, How to name each plot, or to add notes like a=x[i], b=y[i] in this cycle x<-c(1,2,3,4,5,6) y<-c(7,8,9,10,11,12) par(mfrow=c(2,3)) for (i in 1:6){ plot(x,y) } Thank y

[R] Extract p-value from linear model

2010-01-07 Thread Trafim Vanishek
Dear all, I have the following question. Is it possible in R to call for the p-value directly in a model like this a <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) b <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) summary(lm(a~(b+0))) or even in this a <- c(4.81,4.17,4.41,3.59,

[R] Printing to PDF in for

2009-12-14 Thread Trafim Vanishek
Hi everybody, I would like to ask if it is possible using pdf function or some other to print plots in cycle such that every new plot is on new page. like this pdf(file="D:/Plot.pdf",width = 9.25,height=9.25, family="Helvetica",pointsize=8,bg="white") for (i in 1:10){ x <- seq(1,40,1) y <- 2*x

Re: [R] Bootstrapping in R

2009-12-09 Thread Trafim Vanishek
I missed number of bootstrap replicates R boot(Reg, bootcoeff, R=10) but still it doesn't work Error in statistic(data, original, ...) : unused argument(s) (original) On Wed, Dec 9, 2009 at 2:46 PM, Trafim Vanishek wrote: > Dear all, > > I have some error trying to bootstrap

[R] Bootstrapping in R

2009-12-09 Thread Trafim Vanishek
Dear all, I have some error trying to bootstrap from a matrix. The error message is "Error in sample(n, n * R, replace = TRUE) : element 2 is empty; the part of the args list of '*' being evaluated was: (n, R)" vv <- c(0.5,3.2,5.4,1.1,1.4,1.2,2.3,2.0) Reg <- matrix(data=vv, nrow = 4, ncol = 2)

[R] How build hist combining data

2009-12-03 Thread Trafim Vanishek
I would like to ask if there is some simple way for building a hist from the following data. mm <-c(2,3,0,4,5,0,2,9,0) mmm <- matrix(mm,ncol=3, nrow=3) x <- c(0,1.45,2.9) in mmm there are frequencies (each column is separate histogram and each row corresponds to value of x). So that for the firs

Re: [R] Joint density kde2d works improperly?

2009-12-02 Thread Trafim Vanishek
t; > DM > > On Wed, Dec 2, 2009 at 2:14 AM, Trafim wrote: > >> Dear all, >> >> Please, look at the following code: >> >> attach(geyser) >> f1 <- kde2d(duration, waiting, n = 5) >> >> a <- 0 >> for (i in 1:5){ >>

[R] Histogram probabilities >1 ????!!!

2009-12-02 Thread Trafim
Hi everybody, well, I definitely don't understand anything. Why the hist function with freq=FALSE gives such a strange result??? R <- c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) hist(R, freq=FALSE, breaks=10) Thanks everybody [[alternative HTML version delete

[R] Joint density kde2d works improperly?

2009-12-02 Thread Trafim
Dear all, Please, look at the following code: attach(geyser) f1 <- kde2d(duration, waiting, n = 5) a <- 0 for (i in 1:5){ for (j in 1:5){ a <- a + f1$z[i,j] } } As far as I understood from Help kde2d returns matrix elements of which are values of joint probability mass function Pr(X=x,Y=y) t

Re: [R] Loop doesn't work

2009-12-01 Thread Trafim
Thanks a lot! I was afraid smth is wrong with my R syntaxis. On Tue, Dec 1, 2009 at 3:58 PM, Barry Rowlingson < b.rowling...@lancaster.ac.uk> wrote: > On Tue, Dec 1, 2009 at 2:01 PM, Trafim wrote: > > Hi everybody, > > > > I have the following problem, the following

[R] Loop doesn't work

2009-12-01 Thread Trafim
Hi everybody, I have the following problem, the following code seems to run only once for i and j and for k from one to M. Doesn't R for increase the argument by itself? for (i in 1:N){ for (j in 1:(Tk-1)){ if((XGrid[i] < Xk[j+1])&(Xk[j] <= XGrid[i])){ for (k in 1:M){ if ((R

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
suggestions. On Mon, Nov 30, 2009 at 5:09 PM, Trafim wrote: > Also what if the grid matrix is not squared? How can I then find this > kernel density matrix/ > > Thanks a lot. > > > On Mon, Nov 30, 2009 at 4:56 PM, Trafim wrote: > >> You are right. >> I brought thi

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
Also what if the grid matrix is not squared? How can I then find this kernel density matrix/ Thanks a lot. On Mon, Nov 30, 2009 at 4:56 PM, Trafim wrote: > You are right. > I brought this example just to see how to use its with two time series. In > reality I have price process an

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
, Nov 30, 2009 at 4:48 PM, David Winsemius wrote: > > On Nov 30, 2009, at 9:30 AM, Trafim wrote: > > Unfortunately, it doesn't work. >> Can you, please, help me with it? >> >> In order to support the notion of a 2 dimensional distribution, you need > a function

[R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x <- seq(1,40,1) y <- 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help [[alternative HTML version deleted]]

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
Unfortunately, it doesn't work. Can you, please, help me with it? Thanks a lot. On Mon, Nov 30, 2009 at 2:53 PM, Trafim wrote: > Seems that I found it - kde2d > > > On Mon, Nov 30, 2009 at 2:36 PM, Trafim wrote: > >> Hi everybody, >> >> I am looking for

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
Seems that I found it - kde2d On Mon, Nov 30, 2009 at 2:36 PM, Trafim wrote: > Hi everybody, > > I am looking for the possibility in R to estimate joint density, just for > example: > > x <- seq(1,40,1) > y <- 2*x+1+5*rnorm(length(x)) > y1 <- x^3+.5*rnorm

[R] Joint density approximation?

2009-11-30 Thread Trafim
Hi everybody, I am looking for the possibility in R to estimate joint density, just for example: x <- seq(1,40,1) y <- 2*x+1+5*rnorm(length(x)) y1 <- x^3+.5*rnorm(length(x)) Is there a way to approximate the density function s.t. I will later be able to calculate f(Y=y, Y1=y1) Thanks a lot

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
I plot only hist(y,freq = FALSE) lines(density(y)) and the graph of density goes higher then hist, but i didn't find any lim parameter for y axes for lines command. Thanks a lot On Mon, Nov 30, 2009 at 1:51 PM, Hrishi Mittal wrote: > > Trafim, > > If you are plotting more t

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Thanks a lot Ted! I use R help but also cannot find how to expand the graph, i.e. sometimes the top of it is cut for some reason. Maybe there are some limits imposed on y axes, but cannot find it. On Mon, Nov 30, 2009 at 12:27 PM, Ted Harding wrote: > On 30-Nov-09 11:09:12, Trafim wr

[R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x <- seq(1,40,1) y <- 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help [[alternative HTML version deleted]]