[R] lm.ridge fit with some dummy variables (w/o intercept)

2007-08-28 Thread Young Cho
I have columns which sum to one. They are membership dummies, fractions are allowed - I made an example: x - c( 9.899898,6.9555431,-1.251,0.5200,0.480,0.000,-2.2384737, 16.791361,6.8924369,-3.286,0.78846154,0.2115385,0.000,-0.4720061,

[R] replacing double for loops with apply's

2007-07-23 Thread Young Cho
Hi, I am doing double for loops to calculate SDs with some weights and wondering if I can get rid of the outer for loop as well. I made a simple examples which is essentially what I am doing. Thanks for your help! -Young #-- # wtd.var is

[R] ylab at the right hand of a plot with two y axes

2007-06-26 Thread Young Cho
When I try to plot two lines ( or scatterplots) with different scales, this is what I have been doing: Suppose: I have y1 and y2 in a very different scale y1 = 1:100 y2 = c(100:1)*10 To plot them on top of each other and denote by different colors: I have to figure out the correct scale '10'

[R] summing up colum values for unique IDs when multiple ID's exist in data frame

2007-05-29 Thread Young Cho
I have data.frame's with IDs and multiple columns. B/c some of IDs showed up more than once, I need sum up colum values to creat a new dataframe with unique ids. I hope there are some cheaper ways of doing it... Because the dataframe is huge, it takes almost an hour to do the task. Thanks so

[R] odbcConnect - no data source and default driver

2007-03-20 Thread Young Cho
I am trying to connect sybase sql databast from R using RODBC pkg and getting the following error ( i chnaged names to my*** but when I actually execute it, I put down names explicitly not calling some character strings) channel = odbcConnect(dsn='mydsn',uid='myid',pwd='mypasswd') Warning

[R] timeDate object - days, months manipulation arithmetic

2007-03-14 Thread Young Cho
Hi, Thanks so much in advance for your help! I just started using 'timeDate' object to manipulate daily time series data. After reading some documents, I created an object 'bizday' to do some business-day computation. E.g. bizday = timeSequence

[R] timeDate business day

2007-03-12 Thread Young Cho
I have a daily time series and have two questions to get some help with. Firs,t I have dates in simple numeric values. e.g. ymd [1] 20050104 20050105 20050106 20050107 20050110 20050111 20050113 20050114 [9] 20050118 20050120 20050121 20050124 20050125 20050126 20050127 20050128 [17] 20050201

Re: [R] timeDate business day

2007-03-12 Thread Young Cho
Thanks so Michael! If you know of a tutorial or introductory document about timeDate manipulation or time series manipulation in R, can you share it? It is hard to find by googling... I'd very appreciate any advice. Young. On Mar 12, 2007, at 9:00 PM, Michael Toews wrote: [1] 20050104

[R] find weighted group mean

2006-10-10 Thread Young Cho
HI, I am trying to figure out an efficient way to calculate group means and associate each entry with it. I made up an example: A = rep(rep(0:1,each=2),3) B = rep(rep(0:1,4),3) C = rep(rep(c(0,0,1,1),2),3) X =cbind(rnorm(24,0,1),runif(24,0,1),A,B,C)

[R] find confounder in covariates

2005-07-21 Thread Young Cho
Hi, I was wondering if there is a way, or function in R to find confounders. For istance, a = sample( c(1:3), size=10,replace=T) X1 = factor( c('A','B','C')[a] ) X2 = factor( c('Aa','Bb','Cc')[a] ) Xmat = data.frame(X1,X2,rnorm(10),rnorm(10)) dimnames(Xmat)[[2]] = c('z1','z2','z3','y')

[R] aregImpute in Hmisc

2005-07-20 Thread Young Cho
Hi, I have a dataframe ds1.2 - 503 categorial variables and 1 continuous response variables. I ran aregImpute to deal with NA's and got the followig error: fmla = terms( Response ~ . ,data=ds1.2) ds.i = aregImpute(fmla,data=ds1.2) Error in matrix(as.double(1), nrow = n, ncol = p, dimnames =

[R] convert to chron objects

2005-07-13 Thread Young Cho
Hi, I have a column of a dataframe which has time stamps like: eh$t[1] [1] 06/05/2005 01:15:25 and was wondering how to convert it to chron variable. Thanks a lot. Young. __ R-help@stat.math.ethz.ch mailing list

[R] scope argument in step function

2005-07-01 Thread Young Cho
Thanks a lot for help in advance. I am switching from matlab to R and I guess I need some time to get rolling. I was wondering why this code : fit.0 - lm( Response ~ 1, data = ds3) step(fit.0,scope=list(upper=~.,lower=~1),data=ds3) Start: AIC= -32.66 Response ~ 1 Call: lm(formula =

[R] Finding out collinearity in regression

2005-06-29 Thread Young Cho
Hi, I am trying to find out a collinearity in explanatory variables with alias(). I creat a dataframe: dat - ds[,sapply(ds,nlevels)=2] dat$Y - Response Explanatory variables are factor and response is continuous random variable. When I run a regression, I have the following error: fit - aov(

Re: [R] Error in contrasts in step wise regression

2005-06-27 Thread Young Cho
[EMAIL PROTECTED] wrote: On Fri, 24 Jun 2005, Young Cho wrote: Hi, I have a problem in getting step function work. This is not coming from step(), but (AFAIK) from model.matrix() called by lm(). One way to debug it is to try fitting the models directly. I am getting the following error

[R] Error in contrasts in step wise regression

2005-06-24 Thread Young Cho
Hi, I have a problem in getting step function work. I am getting the following error: fit1 - lm(Response~1) fmla - as.formula(paste( ~ ,paste(colnames,collapse=+))) sfit - step(fit1,scope=list(upper= fmla,lower= ~1),k=log(nrow(dat))) Start: AIC= -1646.66 Response ~ 1 Error in