Re: [R] lm fails on some large input

2019-04-18 Thread Dingyuan Wang
The final goal is to make two lines and find the intersection point. I don't want to argue more about the reason. The tol suggestion is reasonable, and I'll take that. 2019/4/19 4:12, Jeff Newmiller: The fact that you think x~y is interchangeable with y~x suggests to me that you will have a di

Re: [R] lm fails on some large input

2019-04-18 Thread Fox, John
gt; Wang > Sent: Thursday, April 18, 2019 12:36 PM > To: Michael Dewey ; r-help@r-project.org > Subject: Re: [R] lm fails on some large input > > I just want to make a line out of timestamps vs some coordinates, so y~x or > x~y doesn't matter. > > Yes, I know the answe

Re: [R] lm fails on some large input

2019-04-18 Thread Jeff Newmiller
The fact that you think x~y is interchangeable with y~x suggests to me that you will have a difficult time convincing R Core that this is a bug. I recommend that you take at leastan upper division college course in linear regression first. On April 18, 2019 9:35:55 AM PDT, Dingyuan Wang wrote:

Re: [R] lm fails on some large input

2019-04-18 Thread Dingyuan Wang
I just want to make a line out of timestamps vs some coordinates, so y~x or x~y doesn't matter. Yes, I know the answer. When trying R, I'm surprised that R can't solve that either. I first noticed that PostgreSQL can't solve it, and found that they fixed that in pg 12. https://www.postgresql

Re: [R] lm fails on some large input

2019-04-18 Thread Jeff Newmiller
I make a general rule not to stick time values into numerical analysis algorithms without first subtracting a reasonable epoch (to obtain difftime) and then using as.numeric.POSIXt with the units argument set explicitly so the analysis uses numeric values that I can interpret. While the explicit

Re: [R] lm fails on some large input

2019-04-18 Thread Fox, John
Dear Peter, > -Original Message- > From: peter dalgaard [mailto:pda...@gmail.com] > Sent: Thursday, April 18, 2019 12:23 PM > To: Fox, John > Cc: Michael Dewey ; Dingyuan Wang > ; r-help@r-project.org > Subject: Re: [R] lm fails on some large input > > Um,

Re: [R] lm fails on some large input

2019-04-18 Thread Berry, Charles
> On Apr 18, 2019, at 8:24 AM, Michael Dewey wrote: > > Perhaps subtract 1506705766 from y? Good advice. Some further notes follow. One can specify `tol` to have a smaller than default value e.g. m2 <- lm(x ~ y, tol=1e-12) which is accurate: plot(y,x) abline(coef=coef(m2)) Users

Re: [R] lm fails on some large input

2019-04-18 Thread William Dunlap via R-help
This sort of data arises quite easily if you deal with time/dates around now. E.g., > d <- data.frame( + when = seq(as.POSIXct("2017-09-29 18:22:01"), by="secs", len=10), + measurement = log2(1:10)) > coef(lm(data=d, measurement ~ when)) (Intercept) when 2.17910611147

Re: [R] lm fails on some large input

2019-04-18 Thread peter dalgaard
d Dingyuan Wang, > >> -Original Message- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael >> Dewey >> Sent: Thursday, April 18, 2019 11:25 AM >> To: Dingyuan Wang ; r-help@r-project.org >> Subject: Re: [R] lm fails on some large inp

Re: [R] lm fails on some large input

2019-04-18 Thread Fox, John
Dear Michael and Dingyuan Wang, > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael > Dewey > Sent: Thursday, April 18, 2019 11:25 AM > To: Dingyuan Wang ; r-help@r-project.org > Subject: Re: [R] lm fails on some large input >

Re: [R] lm fails on some large input

2019-04-18 Thread Michael Dewey
Perhaps subtract 1506705766 from y? Saying some other software does it well implies you know what the _correct_ answer is here but I would question what that means with this sort of data-set. On 17/04/2019 07:26, Dingyuan Wang wrote: Hi, This input doesn't have any interesting properties ex

[R] lm fails on some large input

2019-04-18 Thread Dingyuan Wang
Hi, This input doesn't have any interesting properties except y is unix time. Spreadsheets can do this well. Is this a bug that lm can't do x ~ y? R version 3.5.2 (2018-12-20) -- "Eggshell Igloo" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bi

Re: [R] lm equivalent of Welch-corrected t-test?

2018-11-14 Thread peter dalgaard
> On 13 Nov 2018, at 16:19 , Paul Johnson wrote: > > Long ago, when R's t.test had var.equal=TRUE by default, I wrote some > class notes showing that the result was equivalent to a one predictor > regression model. Because t.test does not default to var.equal=TRUE > these days, I'm curious to

[R] lm equivalent of Welch-corrected t-test?

2018-11-13 Thread Paul Johnson
Long ago, when R's t.test had var.equal=TRUE by default, I wrote some class notes showing that the result was equivalent to a one predictor regression model. Because t.test does not default to var.equal=TRUE these days, I'm curious to know if there is a way to specify weights in an lm to obtain th

Re: [R] lm model with many categorical variables

2016-09-20 Thread Bert Gunter
You need statistical help, which is generally off topic here. I suggest you post to a statistcal site like stats.stackexchange.com instead. Better yet, find a local statistical expert with whom you can consult. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep com

Re: [R] lm model with many categorical variables

2016-09-20 Thread Ismail SEZEN
> On 20 Sep 2016, at 11:34, Michael Haenlein wrote: > > Dear all, > > I am trying to estimate a lm model with one continuous dependent variable > and 11 independent variables that are all categorical, some of which have > many categories (several dozens in some cases). If I’m not wrong, ( I as

[R] lm model with many categorical variables

2016-09-20 Thread Michael Haenlein
Dear all, I am trying to estimate a lm model with one continuous dependent variable and 11 independent variables that are all categorical, some of which have many categories (several dozens in some cases). I am not interested in statistical inference to a larger population. The objective of my mo

Re: [R] lm() silently drops NAs

2016-07-30 Thread Martin Maechler
> peter dalgaard > on Tue, 26 Jul 2016 23:30:31 +0200 writes: >> On 26 Jul 2016, at 22:26 , Hadley Wickham >> wrote: >> >> On Tue, Jul 26, 2016 at 3:24 AM, Martin Maechler >> wrote: >>> > ... >> To me, this would be the most sensible default behavio

Re: [R] lm() silently drops NAs

2016-07-26 Thread Andrew Robinson
Agh. I've argued elsewhere that the default behaviour should be to fail, and the user should take the responsibility to explicitly handle the missing values, even if that simply be by changing the argument. Probably Peter and I have different experiences with the completeness of datasets, but anyt

Re: [R] lm() silently drops NAs

2016-07-26 Thread peter dalgaard
> On 26 Jul 2016, at 22:26 , Hadley Wickham wrote: > > On Tue, Jul 26, 2016 at 3:24 AM, Martin Maechler > wrote: >> ... > To me, this would be the most sensible default behaviour, but I > realise it's too late to change without breaking many existing > expectations. Probably. Re. the defaul

Re: [R] lm() silently drops NAs

2016-07-26 Thread Hadley Wickham
> I think that's a bit too strict for me, so I wrote my own: > > na.warn <- function(object, ...) { > missing <- complete.cases(object) > if (any(missing)) { > warning("Dropping ", sum(missing), " rows with missing values", > call. = FALSE) > } > > na.exclude(object, ...) > } That shou

Re: [R] lm() silently drops NAs

2016-07-26 Thread Hadley Wickham
On Tue, Jul 26, 2016 at 3:24 AM, Martin Maechler wrote: > I have been asked (in private) Martin was very polite to not share my name, but it was me :) > > Hi Martin, > > y <- c(1, 2, 3, NA, 4) > x <- c(1, 2, 2, 1, 1) > > t.test(y ~ x) > lm(y ~ x) > > > Normally, most R fu

Re: [R] lm() silently drops NAs

2016-07-26 Thread Martin Maechler
I have been asked (in private) > Hi Martin, y <- c(1, 2, 3, NA, 4) x <- c(1, 2, 2, 1, 1) t.test(y ~ x) lm(y ~ x) > Normally, most R functions follow the principle that > "missings should never silently go missing". Do you have > any background on why these functi

Re: [R] lm() with spearman corr option ?

2016-04-29 Thread Cade, Brian
I think you would just need to replace the lm() function call with cor(x,y,method="spearman". It would probably be more informative to actually plot by the magnitude of the correlation coefficient (all |r| >= 0.20 or something similar) rather than just by those with P <=0.05. Brian Brian S. Cade

Re: [R] lm() with spearman corr option ?

2016-04-28 Thread Bert Gunter
Please read ?lm! -- where it says: method: the method to be used; for fitting, currently only method = "qr" is supported; method = "model.frame" returns the model frame (the same as with model = TRUE, see below). More to the point, your request for a "spearman" method for lm() makes little or no

[R] lm() with spearman corr option ?

2016-04-28 Thread Hoji, Akihiko
Hi, A following function was kindly provided by GGally’s maintainer, Barret Schloerke. function(data, mapping, ...) { p <- ggplot(data = data, mapping = mapping) + geom_point(color = I("blue")) + geom_smooth(method = "lm", color = I("black"), ...) + theme_blank() +

[R] lm-step: use train-data model to validate test-data

2016-02-22 Thread Amoy Yang via R-help
I have model-data named as: model that is split as model.T(train) and model.V(test or validation). The least square model (from lm to step) is built withmodel.T and I like to see how model.T is robust by comparing predicted model.V toactual model.V. How do I get score for model.V based on model

Re: [R] lm

2016-02-20 Thread Jeff Newmiller
Your first predict sets up a newdata with a column name that is not the same as the one that you used in the lm formula. The failure to match causes R to look in the global environment, where it finds AT. You really should make a habit of always putting your regression data into a data.frame an

[R] lm

2016-02-20 Thread Yuan Jian via R-help
Hello,I used l  to draw a figure, but I got different result (26 vs 301) when I input the same parameters. > length(predict(lm(A$Counts ~ AT),list(ATE=timevalues))) [1] 26 > length(predict(lm(A$Counts ~ ATE),list(ATE=timevalues))) [1] 301 all variables are initialized as below: >A <- structure(l

Re: [R] lm model exported from R to excel

2015-05-06 Thread Duncan Mackay
Duncan -Original Message- From: John Kane [mailto:jrkrid...@inbox.com] Sent: Thursday, 7 May 2015 01:34 To: Duncan Mackay; R Subject: Re: [R] lm model exported from R to excel And for those of us who know close to nothing about HTML I found just now that under a basic print.xtable commmand

Re: [R] lm model exported from R to excel

2015-05-06 Thread David L Carlson
ia Vestergaard Sent: Wednesday, May 6, 2015 7:37 AM To: Duncan Mackay; R Subject: Re: [R] lm model exported from R to excel Hi Duncan Thank you so much - it worked :) Best Livia Fra: Duncan Mackay [dulca...@bigpond.com] Sendt: 6. maj 2015 14:26 Til: R; Livia

Re: [R] lm model exported from R to excel

2015-05-06 Thread Livia Maria Vestergaard
Hi Duncan Thank you so much - it worked :) Best Livia Fra: Duncan Mackay [dulca...@bigpond.com] Sendt: 6. maj 2015 14:26 Til: R; Livia Maria Vestergaard Emne: RE: [R] lm model exported from R to excel Hi Livia There are several html packages that

Re: [R] lm model exported from R to excel

2015-05-06 Thread John Kane
lf-decent formatting with it. Meanwhile, back to LaTeX where the output looks beautiful. I like booktabs :) John Kane Kingston ON Canada > -Original Message- > From: dulca...@bigpond.com > Sent: Thu, 7 May 2015 00:32:48 +1000 > To: r-help@r-project.org > Subject: Re: [R]

Re: [R] lm model exported from R to excel

2015-05-06 Thread Duncan Mackay
-Original Message- From: Livia Maria Vestergaard [mailto:lves...@student.sdu.dk] Sent: Wednesday, 6 May 2015 22:37 To: Duncan Mackay; R Subject: SV: [R] lm model exported from R to excel Hi Duncan Thank you so much - it worked :) Best Livia Fra

Re: [R] lm model exported from R to excel

2015-05-06 Thread Duncan Mackay
function to do things Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Livia Maria Vestergaard Sent: Wednesday,

Re: [R] lm model exported from R to excel

2015-05-06 Thread PIKAL Petr
trix like object e.g. by write.table(tab, "clipboard", sep = "\t", row.names = F) and in Excel you can use ctrl V. So first you need to transform list or its part to be suitable for Excel. Cheers Petr > -----Original Message- > From: R-help [mailto:r-help-bou

Re: [R] lm model exported from R to excel

2015-05-06 Thread Jim Lemon
Hi Livia, One way is to use the "delim.table" function in the prettyR package. See the examples, in particular the final one. The resulting TAB delimited file will usually import directly into Excel. Jim On Wed, May 6, 2015 at 7:36 PM, Livia Maria Vestergaard wrote: > Hi all > I all. I am wonde

[R] lm model exported from R to excel

2015-05-06 Thread Livia Maria Vestergaard
Hi all I all. I am wondering whether anybody know how to export an output of an lm model from R to excel in order to have excel recognize the table that comes and divide the numbers in the table into columns and rows? I really hope it is possible? :) Best Livia ___

Re: [R] LM() and time in R

2015-04-30 Thread Livia Maria Vestergaard
te...@utoronto.ca] Sendt: 29. april 2015 20:25 Til: Livia Maria Vestergaard Cc: r-help mailing list Emne: Re: [R] LM() and time in R Have a look at the help page for the function ts() (type ?ts at the R prompt). Other than that, you haven't provided nearly enough information for us to diagnos

Re: [R] LM() and time in R

2015-04-30 Thread Jim Lemon
t; So instead I would like to check if the time "hh:mm:ss" have an effect on the > price. I know how to tell R about the date by as.Date() , but not with the > time, how can I do that? > > > Or do you guys maybe a third idea about what should make a regression about >

Re: [R] LM() and time in R

2015-04-29 Thread Jim Lemon
Hi Livia, >From your description, it sounds like the "time" variable is actually a vector of date strings like "30/04/2015". These will usually be input as "factors" in R, meaning that you probably had a very large number of categorical values instead of numeric. To find out, do this: is.factor(ti

Re: [R] LM() and time in R

2015-04-29 Thread Boris Steipe
Have a look at the help page for the function ts() (type ?ts at the R prompt). Other than that, you haven't provided nearly enough information for us to diagnose your issue. Please see here for some hints on how to ask questions productively: http://adv-r.had.co.nz/Reproducibility.html http://

[R] LM() and time in R

2015-04-29 Thread Livia Maria Vestergaard
Hello, I need some help with a project that I’m working one. Im trying to make a l regression model (lm) in r with time as independant variable and gas prices as the depended. But It seems like everything im trying to run it, R freeze, I think that I need to tell R somehow that my time is time

Re: [R] lm() funtion

2015-04-24 Thread Bert Gunter
You really really really need to work with a local statistical expert, as your post indicates fundamental confusion. Furthermore, statistical issues are off topic here. Cheers, Bert On Friday, April 24, 2015, Praveen kr singh wrote: > Hi, > > Currently i am working with the lm() function for so

Re: [R] lm() funtion

2015-04-24 Thread Suzen, Mehmet
try lm.ridge from MASS package. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,

[R] lm() funtion

2015-04-24 Thread Praveen kr singh
Hi, Currently i am working with the lm() function for some regressions required for my project. suppose the formula parameter in that is given by "response ~ terms",after some testing i found out that when the number of observations under terms is less than the number of columns or features un

Re: [R] lm weights argument within function

2014-08-01 Thread William Dunlap
One way to accomplish this is to assign a new environment to the formula, an environment which inherits from the formula's original environment but one that you can add things to without affecting the original environment. Also, since you do this in a function only the copy of the formula in the f

[R] lm weights argument within function

2014-08-01 Thread Daniel Caro
Hi all, I need to loop over "lm" within a function using "weights". For example: mydata = data.frame(y=rnorm(100, 500, 100), x= rnorm(100), group=rep(c(0,1), 50), myweight=1/runif(100)) reg.by.wt <- function(formula, wt, by, data) { if(missing(by)) { summary(lm(formula=formula, data=data,

[R] lm and 450k data

2014-07-12 Thread Jessica Timms
Hi, I'm quite new to R and currently trying to use lm to fit linear models but I am currently stuck my code is as follows: Model1 = function(meth_matrix,exposure, X1, X2, X3, batch) { mod = lm(meth_matrix[, methcol]~exposure+X1+X2+X3+batch) res = summary(mod)$coef[2,] system.time(in

Re: [R] lm models over all possible pairwise combinations of the columns of two matrices

2014-04-22 Thread Bert Gunter
Well... If my arithmetic and understanding is correct, that's 32 billion combinations, which, to put it politely, is nuts. As all you'll be doing is generating random numbers anyway, the fastest way to do this is just to use a random number generator. Cheers, Bert Bert Gunter Genentech Nonclinic

[R] lm models over all possible pairwise combinations of the columns of two matrices

2014-04-22 Thread Matthew Robinson
Dear all, I am working through a problem at the moment and have got stuck. I have searched around on the help list for assistance but could not find anything - but apologies if I have missed something. A dummy example of my problem is below. I will continue to work on it, but any help would be

Re: [R] lm predictions for rows with missing y values

2014-04-15 Thread Rui Barradas
Hello, I believe you want na.action = na.exclude. lmnew <- lm(newy ~ newx,newdata,na.action=na.exclude) na.action can not be set to TRUE or FALSE. From the help page ?lm na.action a function which indicates what should happen when the data contain NAs. The default is set by the na.ac

Re: [R] lm predictions for rows with missing y values

2014-04-15 Thread Bert Gunter
Yes. I believe what you're looking for is: See ?predict.lm and what it has to say about the na.action=na.exclude argument to lm. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wis

[R] lm predictions for rows with missing y values

2014-04-15 Thread Mast, Brent D
Hi. I'm trying to produce lm fitted values and standard errors for cases with missing y values. I know how to compute these myself with matrix algebra, but I'm wondering if there is an appropriate na.action in the lm function to do this. Here is some simple code where I use na.action=NULL with

Re: [R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Prof Brian Ripley
Please see the posting guide: posting 3 times only reduces your chance of an informative answer (as does posting in HTML). Your posting is too vague for others to know what it is you do not understand. R is Open Source: please read the sources for the definitive answer to the 'know the comput

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x

Re: [R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread Milan Bouchet-Valat
Le mercredi 06 mars 2013 à 09:18 -0800, Jonas125 a écrit : > Length(Datasplit) = 7100 > > I did a regression for Datasplit[[1]] and the calculated columns --> the > object size is 70 MB. Quite large 7100*70/1024 = 485 (GB) No wonder why you run out of memory quite fast. You probably do not n

Re: [R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread Jonas125
Length(Datasplit) = 7100 I did a regression for Datasplit[[1]] and the calculated columns --> the object size is 70 MB. Quite large Assuming that R cannot handle inf values in regressions (didn't have the time to google it) How can I avoid the calculation of infinite values? Like "If the deno

Re: [R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread Milan Bouchet-Valat
Le mercredi 06 mars 2013 à 08:31 -0800, Jonas125 a écrit : > The datatable (and the split obviously) only contain characters and numeric > data. > > I found that 4 regression in a row work if I don't use the calculated > columns as variables but 2 of the original columns. > RAM usage stays below

Re: [R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread Jonas125
The datatable (and the split obviously) only contain characters and numeric data. I found that 4 regression in a row work if I don't use the calculated columns as variables but 2 of the original columns. RAM usage stays below 3GB! --> Why does R has such problems with the calculated columns? Thei

Re: [R] lm and Formula tutorial

2013-03-06 Thread Bert Gunter
I may be wrong, but I believe what makes it difficult is that the Help file assumes some linear model statistics that you may not have. I suggest that you look for a tutorial on linear models first and then re-read the Help. Incidentally, the provenance of the syntax is GLIM (correction requested i

Re: [R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread R. Michael Weylandt
On Wed, Mar 6, 2013 at 9:51 AM, Jonas125 wrote: > Hello, > > I am a rather unexperienced r-user (learned the language 1 month ago) and > run into the following problem using a local computer with 6 cores & 24 GB > RAM and R 2.15 64-bit. I didn't install any additional packages > > 1. Via the read.

Re: [R] lm and Formula tutorial

2013-03-06 Thread Eva Prieto Castro
Dear Alex, Here you have some url's: http://data.princeton.edu/R/linearModels.html http://www.r-bloggers.com/r-tutorial-series-simple-linear-regression/ Regards, Eva --- El mié, 6/3/13, Alaios escribió: De: Alaios Asunto: [R] lm and Formula tutorial Para: "R help" Fecha:

[R] lm Regression takes 24+ GB RAM - Error message

2013-03-06 Thread Jonas125
Hello, I am a rather unexperienced r-user (learned the language 1 month ago) and run into the following problem using a local computer with 6 cores & 24 GB RAM and R 2.15 64-bit. I didn't install any additional packages 1. Via the read.table command I load a data table (with different data types)

[R] lm and Formula tutorial

2013-03-05 Thread Alaios
Dear all, I was reading last night the lm and the Formula manual page, and 'I have to admit that I had tough time to understand their syntax. Is there a simpler guide for the dummies like me to start with? I would like to thank you in advance for your help Regards Alex [[alternative HTM

Re: [R] lm regression query

2013-02-15 Thread Bert Gunter
Smells like homework to me. If so, we don't do homework on this list. -- Bert On Thu, Feb 14, 2013 at 3:55 PM, email wrote: > Hello: > > I have a 4-column dataset: Crime, Education, Urbanization, Age. I want to > construct a multiple linear regression to find the effect of Education, > Urbanizat

Re: [R] lm regression query

2013-02-14 Thread Nicole Ford
> > You could also run it and find out. There are many R tutorials free online. I presume crime is continuous, as well...? ~Nicole Ford Graduate Instructor Department of Government and International Affairs University of South Florida office: SOC 012M e: nmhi...@mail.usf.edu http://gi

Re: [R] lm regression query

2013-02-14 Thread Nicole Ford
You will also need to specify/ name your model: Mod <- lm(Crime~. ~Nicole Ford Graduate Instructor Department of Government and International Affairs University of South Florida office: SOC 012M e: nmhi...@mail.usf.edu http://gia.usf.edu/student/nford/ Sent from my iPhone On Feb 14, 201

Re: [R] lm regression query

2013-02-14 Thread Pascal Oettli
Hi, Did you read the help file? Particularly the section "Details". ?lm Regards, Pascal Le 15/02/2013 08:55, email a écrit : Hello: I have a 4-column dataset: Crime, Education, Urbanization, Age. I want to construct a multiple linear regression to find the effect of Education, Urbanization,

[R] lm regression query

2013-02-14 Thread email
Hello: I have a 4-column dataset: Crime, Education, Urbanization, Age. I want to construct a multiple linear regression to find the effect of Education, Urbanization, and Age on Crime" lm(Crime ~ Education + Urbanization + Age) If I use + in above statement, does it mean it will build a model to

Re: [R] lm function - na.action

2012-11-09 Thread R. Michael Weylandt
On Fri, Nov 9, 2012 at 5:21 PM, tesssa wrote: > How do you lm throw away excess data points. I am following the > documentation with no success Why would you want to throw away this data? I think that's generally considered sub-optimal model-fitting technique, thought it might explain your diffi

Re: [R] lm function - strange error

2012-11-09 Thread John Kane
ox.com Subject: Re: [R] lm function - strange error Hi Tessa, I agree with John. I think you've made a typo, but looking at your data I think the zero concentration should not be there. Try plotting it. conc = c(10, 20, 30, 40, 50) signal = c (4, 22, 44, 60, 82) plot(

Re: [R] lm function - strange error

2012-11-09 Thread John Kane
> -Original Message- > From: sarah.gos...@gmail.com > Sent: Fri, 9 Nov 2012 14:34:57 -0500 > To: jrkrid...@inbox.com > Subject: Re: [R] lm function - strange error > > On Fri, Nov 9, 2012 at 2:20 PM, John Kane wrote: >> >>> -Original Message--

Re: [R] lm function - strange error

2012-11-09 Thread Tom Shatwell
60, 82, NA) > lm.r <- lm( signal ~ conc) > summary(lm.r) > > I hope this helps. > John Kane > Kingston ON Canada > > > > -Original Message- > > From: tesara...@gmail.com > > Sent: Fri, 9 Nov 2012 09:36:23 -0800 (PST) > > To: r-he

Re: [R] lm function - strange error

2012-11-09 Thread Sarah Goslee
On Fri, Nov 9, 2012 at 2:20 PM, John Kane wrote: > >> -Original Message- >> From: dwinsem...@comcast.net >> Sent: Fri, 9 Nov 2012 10:56:48 -0800 >> To: tesara...@gmail.com >> Subject: Re: [R] lm function - strange error >> >> >> On Nov 9,

Re: [R] lm function - strange error

2012-11-09 Thread John Kane
> -Original Message- > From: dwinsem...@comcast.net > Sent: Fri, 9 Nov 2012 10:56:48 -0800 > To: tesara...@gmail.com > Subject: Re: [R] lm function - strange error > > > On Nov 9, 2012, at 9:16 AM, tesssa wrote: > >> Sorry it is not a comma but a t

Re: [R] lm function - strange error

2012-11-09 Thread John Kane
lm.r) I hope this helps. John Kane Kingston ON Canada > -Original Message- > From: tesara...@gmail.com > Sent: Fri, 9 Nov 2012 09:36:23 -0800 (PST) > To: r-help@r-project.org > Subject: Re: [R] lm function - strange error > > Here is the document > > http://

Re: [R] lm function - strange error

2012-11-09 Thread David Winsemius
On Nov 9, 2012, at 9:16 AM, tesssa wrote: > Sorry it is not a comma but a tilda. The R.help message editor Please > replace the dash with a tilda as lm function requires It might be interesting to have such a supernatural entity zooming around the Rhelp Universe answering prayers from newbi

Re: [R] lm function - strange error

2012-11-09 Thread tesssa
Here is the document http://www.montefiore.ulg.ac.be/~kvansteen/GBIO0009-1/ac20092010/Class8/Using%20R%20for%20linear%20regression.pdf -- View this message in context: http://r.789695.n4.nabble.com/lm-function-strange-error-tp4649065p4649080.html Sent from the R help mailing list archive at Na

[R] lm function - na.action

2012-11-09 Thread tesssa
How do you lm throw away excess data points. I am following the documentation with no success -- View this message in context: http://r.789695.n4.nabble.com/lm-function-na-action-tp4649075.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] lm function - strange error

2012-11-09 Thread tesssa
Sorry it is not a comma but a tilda. The R.help message editor Please replace the dash with a tilda as lm function requires -- View this message in context: http://r.789695.n4.nabble.com/lm-function-strange-error-tp4649065p4649074.html Sent from the R help mailing list archive at Nabbl

Re: [R] lm function - strange error

2012-11-09 Thread John Kane
anada > -Original Message- > From: tesara...@gmail.com > Sent: Fri, 9 Nov 2012 08:37:13 -0800 (PST) > To: r-help@r-project.org > Subject: [R] lm function - strange error > > I am following a document teaching how to use regression and right at the > onset I get a

Re: [R] lm function - strange error

2012-11-09 Thread R. Michael Weylandt
On Fri, Nov 9, 2012 at 4:37 PM, tesssa wrote: > I am following a document teaching how to use regression and right at the > onset I get an R error. I understand that variables "conc" and "signal" > should have the same length but I am using the what R manual suggests to > drop the error and it i

[R] lm function - strange error

2012-11-09 Thread tesssa
I am following a document teaching how to use regression and right at the onset I get an R error. I understand that variables "conc" and "signal" should have the same length but I am using the what R manual suggests to drop the error and it is not cooperating. What gives? The manual says that

[R] lm and glm

2012-10-23 Thread Elaine Kuo
Dear list, I am making a linear regression of the following format. lm(Y~X1+X2+log(X3)+log(X4)) Now I would like to check the linear regression above using generalized linear model. Please kindly if the following format is correct and thank you. (If it is wrong, please indicate why.) glm(Y~X1+

Re: [R] lm on matrix data

2012-10-11 Thread Jean V Adams
Baoqiang, Here's an approach that should work: (1) Make sure that the column names of trainx and testx are the same. (2) Combine trainy and trainx into a data frame for fitting the model. (2) Use the newdata= argument in the predict() function. (3) Convert testx from matrix to data frame. # some

Re: [R] lm on matrix data

2012-10-10 Thread R. Michael Weylandt
On Wed, Oct 10, 2012 at 3:35 PM, Baoqiang Cao wrote: > Hi, > > I have a question about using lm on matrix, have to admit it is very > trivial but I just couldn't find the answer after searched the mailing > list and other online tutorial. It would be great if you could help. > > I have a matrix "t

[R] lm on matrix data

2012-10-10 Thread Baoqiang Cao
Hi, I have a question about using lm on matrix, have to admit it is very trivial but I just couldn't find the answer after searched the mailing list and other online tutorial. It would be great if you could help. I have a matrix "trainx" of 492(rows) by 220(columns) that is my x, and trainy is 49

Re: [R] lm without intercept

2012-08-14 Thread citynorman
The cor(mtcars$mpg, fitted(m0))^2 method works great - thanks so much Josh! I've had another instance (also ex intercept) where it actually gave the correct number, odd behavior. Thanks for the other posts also. As an aside, in my application a zero intercept makes economic sense and I'm using R

Re: [R] lm with a single X and step with several Xi-s, beta coef. quite different:

2012-08-08 Thread Ista Zahn
Hi, Sounds like suppression -- see e.g., http://www.jstor.org/stable/2988294?seq=1 for a discussion. Since this is not an R question but a statistical one, it may be more appropriate to post this question to a statistics forum such as http://stats.stackexchange.com/ Best, Ista On Tue, Aug 7, 20

[R] lm with a single X and step with several Xi-s, beta coef. quite different:

2012-08-07 Thread Aldi Kraja
Hi, (R version 2.15.0) I am running a pgm with 1 response (earlier standardized Y) and 44 independent vars (Xi) from the same data =a2: When I run the 'lm' function on single Xi at a time, the beta coefficient for let's say X1 is = -0.08 (se=0.03256) But when I run the same Y with 44 Xi-s with t

Re: [R] lm without intercept

2012-07-29 Thread peter dalgaard
On Feb 18, 2011, at 14:20 , Jan wrote: > One of the references you googled suggests that intercepts should never > be omitted. Is this true even if I know that the physical reality behind > the numbers suggests an intercept of zero? No. That'll be a piece of pragmatic advice caused by the experie

Re: [R] lm without intercept

2012-07-29 Thread peter dalgaard
On Feb 18, 2011, at 14:20 , Jan wrote: > Hello Achim, > >> Not quite. Consult your statistics textbook for the correct interpretation >> of p-values. Under the null hypothesis of a true intercept of zero, it is >> very likely to observe an intercept as large as 13.52 or larger. > thank you for

Re: [R] lm without intercept

2012-07-28 Thread Joshua Wiley
Hi, R actually uses a different formula for calculating the R square depending on whether the intercept is in the model or not. You may also find this discussion helpful: http://stats.stackexchange.com/questions/7948/when-is-it-ok-to-remove-the-intercept-in-lm/ If you conceptualize R^2 as the sq

Re: [R] lm without intercept

2012-07-28 Thread citynorman
I've just picked up R (been using Matlab, Eviews etc) and I'm having the same issue. Running reg=lm(ticker1~ticker2) gives R^2=50% while running reg=lm(ticker1~0+ticker2) gives R^2=99%!! The charts suggest the fit is worse not better and indeed Eviews/Excel/Matlab all say R^2=15% with intercept=0.

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Christof Kluß
for example the same model with intercept R² = 0.6, without intercept R² = 0.9 and higher. In my definition of R², R² has to be equal or less without intercept I do not know what R shows, but in the summary of the model without intercept it does not show the R² of the regression line. When I run

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread Gabor Grothendieck
On Wed, Jun 27, 2012 at 4:36 AM, Christof Kluß wrote: > > for example the same model with intercept R² = 0.6, without intercept R² > = 0.9 and higher. In my definition of R², R² has to be equal or less > without intercept > > I do not know what R shows, but in the summary of the model without > in

Re: [R] lm without intercept, false R-squared

2012-06-27 Thread peter dalgaard
On Jun 27, 2012, at 13:15 , Uwe Ligges wrote: > > 1 - crossprod(residuals(model)) / crossprod(y - mean(y)) And the reason why that is not used in R: > y<- rnorm(100,10,1) > x <- 1:100 > model <- lm(y~x-1) > > 1 - crossprod(residuals(model)) / crossprod(y - mean(y)) [,1] [1,] -27.600

  1   2   3   4   >