similar to: Question about multiple regression

Displaying 20 results from an estimated 30000 matches similar to: "Question about multiple regression"

2009 Apr 23
4
rbind data frames stored in a list
Hello everyone! I have a list X with 3 elements, each of which is a data frame, for example: a<-data.frame(a=1,b=2,c=3) b<-data.frame(a=c(4,7),b=c(5,8),c=c(6,9)) c<-data.frame(a=c(10,13,16),b=c(11,14,17),c=c(12,15,18)) X<-list() X[[1]]<-a X[[2]]<-b X[[3]]<-c (X) How can I most effectively transform X into a data frame with columns a, b, and c? I would love to find a generic
2009 Mar 26
2
Analogy for %in% for the whole columns (rather than individual values)
Hello! I have a matrix a with 2 variables (see below) that contain character strings. I need to create a 3rd variable that contains True if the value in column x is equal to the value in column y. The code below does it. a<-data.frame(x=c("john", "mary", "mary", "john"),y=c("mary","mary","john","john"))
2009 Feb 11
2
changing settings on a barchart (lattice)
Hello! I apologize - I never used lattice before, so my question is probably very basic - but I just can't find the answer in the archive nor in the documentation: I have a named numeric vector p of 6 numbers (of the type 6 numbers with people's names to whom those numbers belong). I want a simple bar chart. I am doing: library(lattice) trellis.par.set(fontsize=list(text=12)) #
2009 Apr 20
7
Fitting linear models
I am not sure if this is an R-users question, but since most of you here are statisticians, I decided to give it a shot. I am using the lm() function in R to fit a dependent variable to a set of 3 to 5 independent variables. For this, I used the following commands: >model1<-lm(function=PBW~SO4+NO3+NH4) Coefficients: (Intercept) SO4 NO3 NH4 0.01323 0.01968
2009 Feb 18
1
interaction.plot - gridlines and formatting legend title...
Thank you for providing advice on this graphics question. I am building an interaction.plot. d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.2,4.4,3.5,3.3,-1.1,-1.3) d[[1]]<-as.factor(d[[1]]) d[[2]]<-as.factor(d[[2]]) print(d) interaction.plot(d$xx, d$yy, d$zz, type="b", col=c("red","blue"), legend=F, lty=c(1,2), lwd=2, pch=c(18,24),
2009 Feb 16
2
Printing out a graph using different graphics devices
Hello, everyone! The code below allows me to produce the graph I want (I know - the colors are strange, but it's just for the sake of an example). After you run the plot<- part and then do print(plot) - that's what I want. However, when I run the bits of code below (with graphics devices) - what they print is different from the original plot. In .png, .emf, and .tiff - my dots change
2009 Feb 13
2
tapply bug? - levels of a factor in a data frame after tapply are intermixed
Hello! I have encountered a really weird problem. Maybe you've encountered it before? I have a large data frame "importances". It has one factor ($A) with 3 levels: 3, 9, and 15. $B is a regular numeric variable. Below I am picking a really small sub-frame (just 3 rows) based on "indices". "indices" were chosen so that all 3 levels of A are present:
2009 Mar 04
2
adding value labels on Interaction Plot
Hello - and sorry for what might look like a simple graphics question. I am building an interaction plot for d: d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.4,3.5,3.3,-1.1,-1.3)) d[[1]]<-as.factor(d[[1]]) d[[2]]<-as.factor(d[[2]]) print(d) interaction.plot(d$xx, d$yy, d$zz, type="b", col=c("red","blue"), legend=F, lty=c(1,2), lwd=2,
2009 Apr 27
2
Problem with R 2.9.0 vs. R2.8.1 with either "survival" package or "predict" function
Just wanted to alert everyone regarding a problem that I only experience with R2.9.0 and not with R2.8.1 when I run both using exactly the same script and the same data. Here is what I do with my data "MyData", 2 predictors (V1 and V2) and my survival DV "Depvar": library(survival)
2008 Dec 19
2
Merging data frames of different length
Hello, everyone! I have list L that contains 99 data frames. All data frames have only one row, but a different number of columns. Some data frames have 3 columns, some - 6 columns, and some - 9 columns. The names of the first 3 columns are identical in all 99 data frames (e.g., A, B, and C). The names of columns 4:6 are identical in data frames that contain 6 and 9 columns (e.g., D, E, and F).
2009 Apr 28
4
Producing customized tickmarks when producing a graph using "curve"
Hello! I am using function "curve" to create a line graph. I was wondering, if it's possible to "turn off" the default tick marks and introduce those tick marks in specific locations. For example, currently in my X axis tick marks are (automatically) at 10, 11, 12, 13 but I want them to be in 5 specific locations, like 9.89, 10.34, etc. Any hint would be greatly
2009 May 18
1
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
Hello! I have a question about my lattice barchart that I am trying to build in Section 3 below. I can't figure out a couple of things: 1. When I look at the dataframe "test" that I am trying to plot, it looks right to me (the group "Total" is always the first out of 5). However, in the chart it is the last. Why? 2. How can I make sure the value labels (on y) are not
2009 Feb 10
1
Putting values and axis X labels on the charts based on allEffects
Dear everybody! Need help with graphics. I am runnig a simple lm and then using allEffects from 'effects' package: require(effects) model<-lm(Y~A+B, data=mydataframe) I am trying to build (for each predictor - A and then B) a plot of means on Y. I was successful doing it like this - in one swoop: ml.eff<-allEffects(ml1, se=F) plot(ml.eff,ylab="Title of Y") Is it
2009 Oct 13
4
replacing period with a space
Dear R-ers! I have x as a variable in a data frame x. x<-data.frame(x=c("aa.bb","cc.dd.ee")) x$x<-as.character(x$x) x I am sorry for such a simple question - but how can I replace all periods in x$x with spaces? sub('.', ' ', x$x) - removes all letters to the left of each period... Thanks a lot for your advice! -- Dimitri Liakhovitski Ninah.com
2009 Feb 09
1
percentage of variance explained by factors
Hello! I've run a simple linear model: result<-lm(DV~A+B+C,data=Data) My Data$A,Data$B, and Data$C are factors. So, lm automatically recoded them into dummy variables. I have all the results I need but one. Question: Where could I see the variance explained by all A dummy variables together, then all B dummy variables together, and all C dummy variables together - when other predictors
2010 Mar 04
4
Analogue to SPSS regression commands ENTER and REMOVE in R?
I am not sure if this question has been asked before - but is there a procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE regression commands in SPSS? Thanks a lot! -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2010 Mar 30
4
Code is too slow: mean-centering variables in a data frame by subgroup
Dear R-ers, I have a large data frame (several thousands of rows and about 2.5 thousand columns). One variable ("group") is a grouping variable with over 30 levels. And I have a lot of NAs. For each variable, I need to divide each value by variable mean - by subgroup. I have the code but it's way too slow - takes me about 1.5 hours. Below is a data example and my code that is too
2009 Apr 23
2
transposing a matrix - row by row?
Hello, I have a matrix that is a product of tapply on a larger data set. Let's assume it looks like this: X<-matrix(c(10,20,30,40,50,60),2,3) dimnames(X)<-list(c("1","2"),c("1","2","3")) (X) 1 2 3 1 10 30 50 2 20 40 60 Is there an efficient way of transforming this matrix into the following matrix: rows columns entries 1
2008 Jan 22
6
recoding one variable into another - but differently for different cases
Hello, I have 2 variables in my sample Data: Data$A and Data$B Variable Data$A can assume values: 1, 2, 3, and 4. Variable Data$B identifies my cases and can assume values: 1 and 2. I need to recode my variable Data$A into a new variable Data$new such that: People who are Data[Data$B %in% 1, ] are recoded like this: Value on Data$A Value on Data$new 1 +1 2
2009 Apr 10
1
Random Forests: Question about R^2
Dear Random Forests gurus, I have a question about R^2 provided by randomForest (for regression). I don't succeed in finding this information. In the help file for randomForest under "Value" it says: rsq: (regression only) - "pseudo R-squared'': 1 - mse / Var(y). Could someone please explain in somewhat more detail how exactly R^2 is calculated? Is "mse"