[R] reading a big file

2007-05-23 Thread Remigijus Lapinskas
Dear All, I am on WindowsXP with 512 MB of RAM, R 2.4.0, and I want to read in a big file mln100.txt. The file is 390MB big, it contains a column of 100 millions integers. > mln100=scan("mln100.txt") Error: cannot allocate vector of size 512000 Kb In addition: Warning messages: 1: Reached total

[R] multivariate normality test

2006-06-29 Thread Remigijus Lapinskas
Hello, Could someone help me to explain the VERY big difference in applying two tests on multivariate normality: library(mvnormtest) data(EuStockMarkets) mshapiro.test(t(EuStockMarkets[15:29,1:4])) Shapiro-Wilk normality test data: Z W = 0.8161, p-value = 0.005955 and library(energy

[R] survival with Weibull

2006-01-17 Thread Remigijus Lapinskas
Hello, I want to test if the Weibull distribution is appropriate for the failure time. When trying to reproduce an example from MASS (the book, Ch. 13.2), I type library(survival) library(MASS) leuk.wei <- survreg( Surv(time)~ag+log(wbc),data=leuk) ntimes <- leuk$time*exp(-leuk.wei$linear.predict

[R] priceIts

2005-09-28 Thread Remigijus Lapinskas
Dear All, There is an example for the priceIts function (the its package) which does not work for me as expected. > ?priceIts > x1 <- priceIts(instrument = c("^ftse"), start = "1998-01-01", + quote = "Close") Error in validObject(.Object) : invalid class "its" object:

[R] What is median in survfit

2005-06-10 Thread Remigijus Lapinskas
Dear All, A very simple question: > library(survival) > fit <- coxph(Surv(time, status) ~ x, data=aml) > survfit(fit) Call: survfit.coxph(object = fit) n events median 0.95LCL 0.95UCL 23 18 30 18 45 I believe I know what is median here, but how to extract i

Re: [R] How to use "lag"?

2005-03-05 Thread Remigijus Lapinskas
I use the following two function for a lagged regression: lm.lag=function(y,lag=1) summary(lm(embed(y,lag+1)[,1]~embed(y,lag+1)[,2:(lag+1)])) lm.lag.x=function(y,x,lag=1) summary(lm(embed(y,lag+1)[,1]~embed(x,lag+1)[,2:(lag+1)])) for, respectively, y_t=a+b_1*y_t-1+...+b_lag*y_t-lag y_t=a+b_1*

Re: [R] How can I simulate Pareto distribution in R?

2005-01-09 Thread Remigijus Lapinskas
If you define Pareto density as p(x)=c*x^(-(c+1)) for x>1, then dpareto <- function(x,c){ if(c<=0)stop("c must be positive") # Diagnostic step ifelse(x<1,0,c/x^(c+1))} ppareto <- function(q,c){ if(c<=0)stop("c must be positive > 0") ifelse(q<1,0,1-1/q^c)} qpareto <- function(p,c){ if(c<=0) stop

[R] R vs EViews - serial correlation

2004-09-23 Thread Remigijus Lapinskas
Dear all, I met with some problems when dealing with a time series with serial correlation. FIRST, I generate a series with correlated errors set.seed(1) x=1:50 y=x+arima.sim(n = 50, list(ar = c(0.47))) SECOND, I estimate three constants (a, b and rho) in the model Y=a+b*X+u, where u=rho*u(-1

[R] predict(arima)

2004-08-29 Thread Remigijus Lapinskas
Dear All, R 1.9.1, Windows When copying and pasting a few lines from the 'predict.Arima' help, I get an error message: > data(lh) > predict(arima(lh, order = c(3,0,0)), n.ahead = 12) Error in eval(expr, envir, enclos) : Object "xreg" not found On the other hand, the following is OK: > data(lh)

[R] automate save.image

2003-10-29 Thread Remigijus Lapinskas
Dear all, Sometimes, during an R session, my computer hangs and I loose all the objects created during this session. Is there a way to automatically type save.image() and savehistory() every 5 minutes? Best regards, Remigijus __ [EMAIL PROTECTED] maili

Re[2]: [R] optim

2003-03-02 Thread Remigijus Lapinskas
Sunday, March 02, 2003, 9:48:26 PM, you wrote: MK> [EMAIL PROTECTED] wrote: >> You are not solving the same problem, which is more than a little `odd'. MK> Why? MK> >>> want to choose the three parameters so that MK> these three integrals are as close to, resp., 2300, 4600 and 5800 as MK> possi

[R] optim

2003-02-28 Thread Remigijus Lapinskas
Dear all, I have a function MYFUN which depends on 3 positive parameters TETA[1], TETA[2], and TETA[3]; x belongs to [0,1]. I integrate the function over [0,0.1], [0.1,0.2] and [0.2,0.3] and want to choose the three parameters so that these three integrals are as close to, resp., 2300, 4600 and 58

Re[2]: [R] Interpolation

2003-02-12 Thread Remigijus Lapinskas
12:09:33 PM, you wrote: PDB> Remigijus Lapinskas <[EMAIL PROTECTED]> writes: >> Dear all, >> >> I have two vectors and connect the points by line segments: >> >> x <- c(1990,1994,1995,1997) >> y <- c(30,40,80,20) >> plot(x,y,type="l&

[R] Interpolation

2003-02-12 Thread Remigijus Lapinskas
Dear all, I have two vectors and connect the points by line segments: x <- c(1990,1994,1995,1997) y <- c(30,40,80,20) plot(x,y,type="l") I want to get the values of y's on these lines at missing x's, i.e., at 1991,1992,1993,and 1996. Is there a simple way to do this? Best regards, Remigijus

Re: [R] Plotting coloured histograms...

2003-01-25 Thread Remigijus Lapinskas
Try the H. Bengtsson's function plot.histogram from http://www.maths.lth.se/matstat/staff/hb/mypackages/R/plot.histogram.R Remigijus Saturday, January 25, 2003, 10:21:30 PM, you wrote: FHFPdR>Hi, I am having some trouble trying to plot a histogram in more than one FHFPdR> colour. What I wan