[R] createDataPartition

2010-09-09 Thread Trafim Vanishek
Dear all, does anyone know how to define the structure of the required samples using function createDataPartition, meaning proportions of different types of variable in the partition? Smth like this for iris data: createDataPartition(y = c(setosa = .5, virginica = .3, versicolor = .2), times =

[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

[R] lm prediction strange error

2010-08-16 Thread Trafim Vanishek
Dear all, I have an error in the simple prediction function for lm(). Maybe someone experienced the same? xma - matrix(data = 0, nrow = 100, ncol = 2) xma[, 1] - rnorm(100) xma[, 2] - rchisq(100, df = 3) m1 - lm(xma[, 1] ~ xma[, 2]) predict(m1, as.data.frame(seq(-13, 13, 0.5))) Thanks a lot,

Re: [R] lm prediction strange error

2010-08-16 Thread Trafim Vanishek
= 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(). Maybe someone experienced the same? xma- matrix(data = 0, nrow = 100, ncol = 2) xma[, 1]- rnorm(100) xma[, 2

[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(

[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-help

[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]]

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 dwinsem...@comcast.netwrote: On Jul 9, 2010, at 9:46 AM, Trafim Vanishek wrote

[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

[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

[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,

[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] 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

[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)

[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

[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] 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] = 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] 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

[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 -

[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

[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 -

[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)

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 rdapam...@gmail.com wrote: Dear all, I have some error trying to bootstrap

[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 first

Re: [R] Joint density kde2d works improperly?

2009-12-02 Thread Trafim Vanishek
Dear Dennis, thanks a lot for your response. I have two time series and need to approximate there joint density. The only thing I cannot find out is how to find the values of this function in the points not from the resulting grid matrix Thanks a lot You're using a function that provides an