search for: xnam

Displaying 10 results from an estimated 10 matches for "xnam".

Did you mean: nam
2004 Oct 11
0
scoping problem when calling step inside a function
...anks in advance, Scott Gilpin ## Example code rm(list=ls()) ## Forward stepwise regression - works fine set.seed(2863) x<-matrix(runif(1000),ncol=10) colnames(x)<-1:10 beta<-matrix(c(1,2,3,4,5,0,0,0,0,0),ncol=1) y<-drop(x %*% beta + rnorm(100)) lsdata<-data.frame(cbind(x=x,y=y)) xnam <- names(lsdata)[names(lsdata) != "y"] (fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+")))) fit<-lm(y ~ 1,data=lsdata) step.fit<-step(fit,scope = fmla, direction="forward",data=lsdata) ## start from scratch rm(list=ls()) set.seed(2863)...
2008 Jul 06
3
Lots of huge matrices, for-loops, speed
...repare .asc-files filenames <- c("R2", "adj.R2", "p", "b0", colnames (x)) for (i in 1:items) { write.table (hd, file = paste (outfolder, filenames [i],".asc",sep =""), quote=F, row.names=F, col.names=F) } rm (hd) # Prepare regression xnam <- paste ("x[,", 1:(ncol(x)),"]", sep="") form <- paste("y ~ ", paste(xnam, collapse="+")) rm (xnam) # Loop through rows for (j in 1:rows) { getgrid <- function (j) { print (paste ("Row",j,"/",rows),quote = F)...
2006 May 24
1
Problem with pasteing formulas (PR#8897)
Hi, If I create a formula with say 100 terms and then paste it: xnam <- paste("x", 1:100, sep="") fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+"))) paste(fmla) The result seems to cut off everything after the first 500 characters and gives no warning message. I have the most recent version of R from the R...
2012 Nov 16
2
R-Square in WLS
Hi, I am fitting a weighted least square regression and trying to compute SSE,SST and SSReg but I am not getting SST = SSReg + SSE and I dont know what I am coding wrong. Can you help please? xnam <-colnames(X) # colnames Design Matrix fmla1 <- as.formula(paste("Y ~",paste(xnam, collapse= "+"),"-1",sep="")) fitlm <- lm(formula=fmla1,data = data.frame(cbind(X,Y))) ResiSqr &l...
2012 Nov 07
5
Calling R object from R function
Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function So I create 4 functions with these arguments M11 <- function(TrainData,TestData,mdat,nsam) { ls <- list() I have few statments one of them is vectx <- c(,1,2,3,4,5,6,6) vectz <- c(12,34,5,6,78,9,90) and then................ ls(vectx=vtecx,vectz=vectz)
2005 Jul 12
2
how to generate argument from a vector automatically
hi netters i have a vector NAMES containing a series of variable names: NAMES=c(x,r,z,m,st,qr,.....nn). i wanna fit a regression tree by using the code: my.tree<-tree(y~x+r+z+m+....nn,my.dataframe) but i don't want to type out "x+r+z+m+....+nn" one by one, as there are so many variables. besides, sometimes i wanna put the code in a function. so i need to have the
2004 Nov 30
3
2k-factorial design with 10 parameters
Hi, I'd like to apply a 2^k factorial design with k=10 parameters. Obviously this results in a quite long term for the model equation due to the high number of combinations of parameters. How can I specify the equation for the linear model (lm) without writing all combinations explicitly down by hand? Does a R command exist for this problematic? Thanks for your help in advance, Sven
2009 Aug 25
1
Problem with correct usage of formula environment
...k is the first line of function iscube, and it seems that the object r.plan cannot be found here. I have no idea how to fix this. In case it helps: The expression generating the formula in function formula.design is as.formula(paste(response, paste(c(names(factor.names), paste("!iscube(",xnam,")",sep="")), collapse="+"),sep="~")) I am grateful for any pointers that direct me to a fix for this problem and/or to a better understanding of its root cause. Thanks and regards, Ulrike -- View this message in context: http://www.nabble.com/Problem-with...
2008 Dec 02
4
Variables inside a for
Hi! I had a database with some variables in sequence. Let me say: TX01, TX02, TX03 and TX04. But I need to run some regressions changing the variables... so: variable <- paste("TX0", 1:4, sep="") for(i in 1:4){ test[i] <- lm(variable[i] ~ INCOME, data=database) } But doesn't work... lm tries to find a variable inside database named variable[i] ... Suggestions?
2012 Apr 17
0
Minor bug: plot.table and Axis.table (partially) ignore graphical parameters (patch included)
...t;- function(x, type = "h", ylim = c(0, max(x)), lwd = 2, - xlab = NULL, ylab = NULL, frame.plot = is.num, ...) + xlab = NULL, ylab = NULL, frame.plot = is.num, axes = TRUE, ...) { + localaxis <- function(..., col, bg, pch, cex, lty, lwd) axis(...) xnam <- deparse(substitute(x)) rnk <- length(dim(x)) if(rnk == 0L) stop("invalid table 'x'") @@ -121,11 +122,7 @@ plot.table <- plot(x0, unclass(x), type = type, ylim = ylim, xlab = xlab, ylab = ylab, frame.plot = frame.plot, lwd = lwd, ..., xaxt = &q...