similar to: lm(y~x) question: removing NA´s

Displaying 20 results from an estimated 50000 matches similar to: "lm(y~x) question: removing NA´s"

2004 May 04
1
RE: more on lm(y~x) question: removing NA´s
1. If your code actually runs, you should upgrade R, and quit using `_' for assignment... 8-) 2. You seem to have an extraneous `]' after the na.exclude. Could that be the problem? Andy > From: Christoph Scherber > > actually, the situation is much more complicated. I am producing > multiple graphs within a "for" loop. For some strange reason, the >
2005 Jan 07
6
coercing columns
Dear all, I have a data frame that looks like this: c1 c2 c3 A B C B C A A A B and so on; I?d like to produce one single vector consisting of the columns c1,c2, c3, such that vector=("A","B","A","B","C","A","C","A","B") I guess it?s easy to do but I don?t know how...Can anyone
2005 May 02
4
"apply" question
Dear R users, I??ve got a simple question but somehow I can??t find the solution: I have a data frame with columns 1-5 containing one set of integer values, and columns 6-10 containing another set of integer values. Columns 6-10 contain NA??s at some places. I now want to calculate (1) the number of values in each row of columns 6-10 that were NA??s (2) the sum of all values on columns 1-5
2008 Jun 07
1
Multivariate LM: calculating F-values after calling linear.hypothesis
Dear R users, I am analyzing several response variables (all scaled to [0;1]) using a multivariate linear model. After fitting the model, I set up a hypothesis matrix to test specific contrasts for these response variables; for example: "a always increases significantly more than b when regressed against x". What I am stuck with now is how to calculate the correct F-values (and
2005 Jan 24
4
lme and varFunc()
Dear R users, I am currently analyzing a dataset using lme(). The model I use has the following structure: model<-lme(response~Covariate+TreatmentA+TreatmentB,random=~1|Block/Plot,method="ML") When I plot the residuals against the fitted values, I see a clear positive trend (meaning that the variance increases with the mean). I tried to solve this issue using weights=varPower(),
2004 Dec 02
1
treatment contrasts and summary.lm
Dear list members, I have a 2-factor ANOVA where the summary.lm output looks like this (using treatment contrasts): Value Std. Error t value Pr(>|t|) (Intercept) 0.0389 0.0220 1.7695 0.0817 as.factor(Block)1 0.0156 0.0066 2.3597 0.0215 as.factor(Block)2 -0.0018 0.0037 -0.4857 0.6289 as.factor(Block)3 -0.0007 0.0026 -0.2812 0.7795
2005 Nov 17
1
Mean survival times
Dear list, I have data on insect survival in different cages; these have the following structure: deathtime status id cage S F G L S 1.5 1 1 C1 8 2 1 1 1 1.5 1 2 C1 8 2 1 1 1 11.5 1 3 C1 8 2 1 1 1 11.5 1 4 C1 8 2 1 1 1 There are 81 cages and
2005 Nov 09
1
trellis: positioning of key
Dear R users, Using xyplot(), how can I position the key in the *margin* outside the plotting area ? My problem is that the key always overlaps with the x axis labels, no matter how I try to specify any of the par() arguments (e.g. oma()). Many thanks for any suggestions! Christoph ### for information, here??s the code I use par(oma=c(0,0,3,0)) ###this, I think, is what should be changed
2008 Nov 25
4
glm or transformation of the response?
Dear all, For an introductory course on glm?s I would like to create an example to show the difference between glm and transformation of the response. For this, I tried to create a dataset where the variance increases with the mean (as is the case in many ecological datasets): poissondata=data.frame( response=rpois(40,1:40), explanatory=1:40) attach(poissondata) However, I have run into
2008 Feb 22
3
Simultaneously summarizing many models
Dear R users, Let?s say I have 10 models, each named m1,m2,m3..., and I would like to summarize them automatically and simultaneously - e.g., to extract parameter estimates later on from all models; how can I do that? I have tried: x=1:10 #this creates some example data y=rnorm(10) m1=lm(x~y) m2=lm(x~1) sum.lms=function(x)summary(paste("m",x,sep="")) sum.lms(1:2) but
2005 Dec 06
1
xyplot question
Dear R users, I have a question regarding the use of xyplot in the lattice() package. I have two factors (each with two levels), and I??d like to change the order of the panels in a 2x2 panel layout from the default alphabetic order that R uses based on the names of the factor levels. My approach is (in principle) xyplot(y~x|Factor1+Factor2) Let??s assume, my factor levels for Factor1 are A
2005 May 04
2
JGR and R 2.0.X
Dear all, I am running Windows XP with several parallel installations of R (2.0.1; 2.1 and so on). How can I install JGR for the 2.0.1 version? I keep on getting error messages when trying to install it. Best wishes Christoph
2008 Jul 03
1
lm() question
I have data that looks like YC Age Num 82 11 2 83 10 0 84 9 8 85 8 21 86 7 49 87 6 18 88 5 79 89 4 28 90 3 273 91 2 175 with a program mod1=lm(log(Num+1)~YC, data=box44) plot(log(Num+1)~YC, data=box44, pch=19, xlab="Year Class", ylab="Loge Number at age", ylim=c(0,6), xlim=c(91,82)) abline(lm(log(Num+1)~YC), col="blue", lwd=2) summary(mod1) I need to
2008 Nov 06
2
replacing characters in formulae / models
Dear all, How can I replace text in objects that are of class "formula"? y="a * x + b" class(y)="formula" grep("x",y) y[1] Suppose I would like to replace the "x" by "w" in the formula object "y". How can this be done? Somehow, the methods that can be used in character objects do not work 1:1 in formula objects... Many
2007 Nov 08
6
Extract correlations from a matrix
Dear R users, suppose I have a matrix of observations for which I calculate all pair-wise correlations: m=matrix(sample(1:100,replace=T),10,10) w=cor(m,use="pairwise.complete.obs") How do I extract only those correlations that are >0.6? w[w>0.6] #obviously doesn?t work, and I can?t find a way around it. I would very much appreciate any help! Best wishes Christoph (using R
2005 Jan 27
4
self-written function
Dear all, I?ve got a simple self-written function to calculate the mean + s.e. from arcsine-transformed data: backsin<-function(x,y,...){ backtransf<-list() backtransf$back<-((sin(x[x!="NA"]))^2)*100 backtransf$mback<-tapply(backtransf$back,y[x!="NA"],mean)
2008 May 27
5
Rotated text on a regression line
Dear all, I stumbled over a problem recently when trying to use srt with text() on a windows device. What I intended to do was to plot a simple regression line, and to rotate a piece of text such that the text has the same angle as the regression line. However, the text is always plotted in a slightly wrong angle: #### x=1:10 #create arbitrary x and y values y=x*2-rnorm(1:10)
2005 Jan 13
2
Naming Convention
I was wondering whether there exists a naming convention for row and column names in R data frames and matrices. E.g: PriceSwap or PRICESWAP or PRICE.SWAP Many thanks. Reinhold [[alternative HTML version deleted]]
2005 Aug 16
1
regression with more than one observation per x value
Dear R users, How can I do a regression analysis in R where there is more than one observation per x value? I tried the example in Sokal&Rohlf (3rd edn., 1995), page 476 ff., but I somehow couldn??t find a way to partition the sums of squares into "linear regression", "deviations from regression", and within-groups SS. I tried
2008 Jun 19
4
Problems with lm()
Dear R-users: I am a new R-user and I have a question about lm function. Here is my data. a<-c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14) b<-c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2) c<-c(2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2) d<-c(2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1)