similar to: How to use a sequence of covariates in linear model (lm)?

Displaying 20 results from an estimated 10000 matches similar to: "How to use a sequence of covariates in linear model (lm)?"

2012 Jul 12
1
Results from mixed linear models
Dear list, I'm quite confused when interpreting results from a mixed linear model. For example, working on Iris data frame, I want to know the effect of species on slope of the model "Petal.Length~Sepal.Length" I write this : data(iris) reg01 <- lm(Petal.Length~Sepal.Length + Sepal.Length:Species, data=iris) summary(reg01) It gives me a summary table with lm for the first
2010 Jun 24
1
Question on WLS (gls vs lm)
Hi all, I understand that gls() uses generalized least squares, but I thought that maybe optimum weights from gls might be used as weights in lm (as shown below), but apparently this is not the case. See: library(nlme) f1 <- gls(Petal.Width ~ Species / Petal.Length, data = iris, weights = varIdent(form = ~ 1 | Species)) aa <- attributes(summary(f1)$modelStruct$varStruct)$weights f2 <-
2007 Oct 10
3
save lm output into vectors
Hi, May I ask how I can save the coefficients and the p values into a table? thanks. jiong The email message (and any attachments) is for the sole...{{dropped:11}}
2008 May 30
1
robust mlm in R?
I'm looking for something in R to fit a multivariate linear model robustly, using an M-estimator or any of the myriad of other robust methods for linear models implemented in robustbase or methods based on MCD or MVE covariance estimation (package rrcov). E.g., one can fit an mlm for the iris data as: iris.mod <- lm(cbind(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) ~ Species,
2008 Feb 27
2
multiple plots per page using hist and pdf
Hello, I am puzzled by the behavior of hist() when generating multiple plots per page on the pdf device. In the following example two pdf files are generated. The first results in 4 plots on one pdf page as expected. However, the second, which swaps one of the plot() calls for hist(), results in a 4 page pdf with one plot per page. How might I get the histogram with 3 other scatter
2011 Jul 28
2
not working yet: Re: lattice overlay
Hi Dieter and R community: I tried both of these three versions with ylim as suggested, none work: I am getting only single (pch = 16) not overlayed (pch =3) everytime. *vs 1* require(lattice) xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris, panel= function(x, y, subscripts) { panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10)) panel.lmline(x, y, lty=4, col =
2008 Oct 13
2
split data, but ensure each level of the factor is represented
Hello, I'll use part of the iris dataset for an example of what I want to do. > data(iris) > iris<-iris[1:10,1:4] > iris Sepal.Length Sepal.Width Petal.Length Petal.Width 1 5.1 3.5 1.4 0.2 2 4.9 3.0 1.4 0.2 3 4.7 3.2 1.3 0.2 4 4.6 3.1 1.5
2006 May 31
2
a problem 'cor' function
Hi list, One of my co-workers found this problem with 'cor' in his code and I confirm it too (see below). He's using R 2.2.1 under Win 2K and I'm using R 2.3.0 under Win XP. =========================================== > R.Version() $platform [1] "i386-pc-mingw32" $arch [1] "i386" $os [1] "mingw32" $system [1] "i386, mingw32" $status
2010 Jun 09
4
question about "mean"
Hi there: I have a question about generating mean value of a data.frame. Take iris data for example, if I have a data.frame looking like the following: --------------------- Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all Is there a simpler method to achieve the following: When I obtain an empty data.frame after subsetting, I need for it to contain one line of NAs. Here's a dummy example: > (.xb <- iris[ iris$Species=='zz', ]) [1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species <0 rows> (or 0-length row.names) > dim(.xb) [1] 0 5 > (.xa <-
2009 Oct 17
1
Easy way to `iris[,-"Petal.Length"]' subsetting?
Dear all What is the easy way to drop a variable by using its name (and not its number)? Example: > data(iris) > head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1
2008 Aug 07
6
multiple tapply
Hi folk, I tried this and it works just perfectly tapply(iris[,1],iris[5],mean) but, how to obtain a single table from multiple variables? In tapply x is an atomic object so this code doesn't work tapply(iris[,1:4],iris[5],mean) Thanx and great summer holidays Gianandrea -- View this message in context: http://www.nabble.com/multiple-tapply-tp18868063p18868063.html Sent from the R help
2004 Aug 21
2
more on apply on data frame
Hi R People: Several of you pointed out that using "tapply" on a data frame will work on the iris data frame. I'm still having a problem. The iris data frame has 150 rows, 5 variables. The first 4 are numeric, while the last is a factor, which has the Species names. I can use tapply for 1 variable at a time: >tapply(iris[,1],iris[,5],mean) setosa versicolor virginica
2012 May 03
1
Identifying case by groups in a data frame
Hi everyone, I would like to identify the case by groups that is just bigger that avg plus sd. For example, using species as group and petal.wid as my variable in the iris data. What's the better way to doit? creating a function? So,the question is to identify the single element of each species that is just larger than a cut-off point (i.e. larger than mean + sd) I made this, but I can not
2011 Aug 16
3
Newbie question - struggling with boxplots
Hopefully I will not be flamed for this on the list, but I am starting out with R and having some trouble with combining plots. I am playing with the famous iris dataset (checking out example dataset in R while reading through Introduction to datamining) What I would like to do is create three graphs (combined boxplots) besides each other for each of the three species (Setosa, Versicolour and
2012 Jul 23
1
duplicated() variation that goes both ways to capture all duplicates
Dear all The trouble with the current duplicated() function in is that it can report duplicates while searching fromFirst _or_ fromLast, but not both ways. Often users will want to identify and extract all the copies of the item that has duplicates, not only the duplicates themselves. To take the example from the man page: > data(iris) > iris[duplicated(iris), ] ##duplicates while
2005 Sep 16
6
How do I get the row indices?
Hi, I was wondering if it's possible to get the row numbers from a filtering. Here's an example: # give me the rows with sepal.length == 6.2 iris[(iris[,1]==6.2),] # output Sepal.Length Sepal.Width Petal.Length Petal.Width Species 69 6.2 2.2 4.5 1.5 versicolor 98 6.2 2.9 4.3 1.3 versicolor 127 6.2
2008 Apr 22
2
cloud plot has white(transparent?) background
I am using the code example from the R graph gallery to look at a cloud plot: require(lattice) data(iris) print(cloud(Sepal.Length ~ Petal.Length * Petal.Width, data = iris, groups = Species, screen = list(z = 20, x = -70), perspective = FALSE, key = list(title = "Iris Data", x = .15, y=.85, corner = c(0,1), border = TRUE,
2017 Jul 28
4
R-Package for Recursive Partitioning without Classification or Regression
Hello, I have a question related to recursive partitioning, but I cannot find an answer, likely because I don't know how to properly word my Google search query. All recursive partitioning examples, which I can find, are used for either classification or regression trees like library(tree) data(iris) tree(Species ~ Sepal.Width + Petal.Width, data = iris) which implies building a
2010 Sep 27
1
Variation of predictor of linear model
Hi folks, I use lm to run regression and I don't know how to predict dependent variable based on the model. I used predict.lm(model, newdata=80), but it gave me warnings. Also, how can I get the variance of dependent variable based on model. Thanks. [[alternative HTML version deleted]]