Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Labone, Thomas
Health University of South Carolina Columbia, South Carolina USA From: Sarah Goslee Sent: Friday, December 3, 2021 11:00 AM To: Labone, Thomas Cc: Bill Dunlap ; r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results It might also be a BLAS

Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Sarah Goslee
t;Min. 1st Qu. MedianMean 3rd Qu.Max. > 0.3767 0.8204 0.9659 0.9947 1.1372 2.4772 > > > > > Thomas R. LaBone > PhD student > Department of Epidemiology and Biostatistics > Arnold School of Public Health > University of South Carolina > Columbia, South Carolina USA > > >

Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Labone, Thomas
h Carolina Columbia, South Carolina USA From: Labone, Thomas Sent: Thursday, December 2, 2021 11:53 AM To: Bill Dunlap Cc: r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results > summary(fit) Call: lm(formula = log(k) ~ Z) Residuals:

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
Cc: r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas mailto:lab...@email.sc.edu>> wrote: In t

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Duncan Murdoch
On 02/12/2021 5:50 a.m., Labone, Thomas wrote: In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Bill Dunlap
On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas wrote: > In the code below the first and second plots should look pretty much the > same, the only difference being that the first h

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Ivan Krylov
On Thu, 2 Dec 2021 14:34:42 + "Labone, Thomas" wrote: > Can someone point me to the procedure for switching from the Intel > Math Library back to the standard math library so that I can see if > the problem is associated with using MKL? Depends on how you have installed it. You mentioned usi

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
University of South Carolina Columbia, South Carolina USA From: J C Nash Sent: Thursday, December 2, 2021 9:31 AM To: Labone, Thomas ; r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results I get two similar graphs. https://protect2

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread J C Nash
I get two similar graphs. https://web.ncf.ca/nashjc/jfiles/Rplot-Labone-4095.pdf https://web.ncf.ca/nashjc/jfiles/RplotLabone10K.pdf Context: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux Mint 20.2 Matrix products: default BLAS: /usr/lib/x86_64-linu

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Eric Berger
Hi Thomas, I could not reproduce your problem. Both examples worked fine for me. Here is my setup: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK

[R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line (incorrect answer from lm), but on my Windows 10

Re: [R] Problem with LM

2018-12-18 Thread Bert Gunter
... Perhaps worth adding is the use of poly() rather than separately created terms for (non/orthogonal) polynomials: lm(y ~ poly(x, degree =2) #orthogonal polyomial of degree 2 see ?poly for details. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along

Re: [R] Problem with LM

2018-12-18 Thread rsherry8
Richard, It is now working. Thank you very much. Bob On 12/18/2018 7:10 PM, Richard M. Heiberger wrote: ## This example, with your variable names, works correctly. z2 <- data.frame(y=1:5, x=c(1,5,2,3,5), x2=c(1,5,2,3,5)^2) z2 class(z2) length(z2) dim(z2) lm(y ~ x + x2, data=z2) ## note that

Re: [R] Problem with LM

2018-12-18 Thread Richard M. Heiberger
## This example, with your variable names, works correctly. z2 <- data.frame(y=1:5, x=c(1,5,2,3,5), x2=c(1,5,2,3,5)^2) z2 class(z2) length(z2) dim(z2) lm(y ~ x + x2, data=z2) ## note that that variable names y, x, x2 are column names of the ## data.frame z2 ## please review the definitions and

[R] Problem with LM

2018-12-18 Thread rsherry8
The values read into z2 came from a CSV file. Please consider this R session: > length(x2) [1] 1632 > length(x) [1] 1632 > length(z2) [1] 1632 > head(z2) [1] 28914.0 28960.5 28994.5 29083.0 29083.0 29083.0 > tail(z2) [1] 32729.65 32751.85 32386.05 32379.75 32379.15 31977.15 > lm ( y ~ x2 + x, z2

Re: [R] Problem with lm

2012-11-05 Thread Eva Prieto Castro
urner escribió: De: Rolf Turner Asunto: Re: [R] Problem with lm Para: "Eva Prieto Castro" CC: "Mick Cooney" , "Greg Snow" <538...@gmail.com>, "William Dunlap" , "r-help@r-project.org" Fecha: lunes, 5 de noviembre, 2012 19:58 On 06/11/12

Re: [R] Problem with lm

2012-11-05 Thread Rolf Turner
On 06/11/12 05:20, Eva Prieto Castro wrote: Hi, I solved as follws: Â f <- formula(y ~ x1 + x2) Â single <- do.call("lm", list(f, data=mydf)) It works in every machine!!. Well, if you are happy with the result, I guess that can't be argued with. However the fact that your previous attempts

Re: [R] Problem with lm

2012-11-05 Thread Eva Prieto Castro
bió: De: Eva Prieto Castro Asunto: RE: [R] Problem with lm Para: "Mick Cooney" , "Greg Snow" <538...@gmail.com>, "William Dunlap" CC: "r-help@r-project.org" Fecha: viernes, 2 de noviembre, 2012 09:47 Hi everybody, I send you two test I made (withou

Re: [R] Problem with lm

2012-11-02 Thread Eva Prieto Castro
yPkt.env$lGlo) 2: RS() 1: MyPkt.RS()    I hope you can put some light in this question, because I am very confused. Thanks in advance.   Cheers, Eva --- El vie, 2/11/12, William Dunlap escribió: De: William Dunlap Asunto: RE: [R] Problem with lm Para: "Eva Prieto Castro"

Re: [R] Problem with lm

2012-11-01 Thread William Dunlap
wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Eva Prieto Castro > Sent: Thursday, November 01, 2012 2:59 PM > To: Mick Cooney; Greg Snow > Cc: r-help@r-project.org > Subject:

Re: [R] Problem with lm

2012-11-01 Thread Eva Prieto Castro
tested.   Cheers, Eva --- El jue, 1/11/12, Greg Snow <538...@gmail.com> escribió: De: Greg Snow <538...@gmail.com> Asunto: Re: [R] Problem with lm Para: "Mick Cooney" CC: "Eva Prieto Castro" , r-help@r-project.org Fecha: jueves, 1 de noviembre, 2012 17:49 Th

Re: [R] Problem with lm

2012-11-01 Thread Nordlund, Dan (DSHS/RDA)
See comments inline > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Mick Cooney > Sent: Thursday, November 01, 2012 9:23 AM > To: Greg Snow > Cc: r-help@r-project.org; Eva Prieto Castro > Subject: Re

Re: [R] Problem with lm

2012-11-01 Thread Mick Cooney
But the 'y' is a parameter to the function, so does this mean that the error is occurring when the function is invoked without that parameter? On 1 November 2012 16:02, Greg Snow <538...@gmail.com> wrote: > Yes, it is most likely due to scoping. It is safest to create a data > frame with all the

Re: [R] Problem with lm

2012-11-01 Thread Greg Snow
This error can still occur even if something is passed as the y parameter to the function. There are several things that can complicate the process (and I don't remember exactly which one causes the problem in this case). Here are a couple: In the original function, y is a parameter, but it is n

Re: [R] Problem with lm

2012-11-01 Thread Greg Snow
Yes, it is most likely due to scoping. It is safest to create a data frame with all the data in it, then pass that to the data argument of lm. On Thu, Nov 1, 2012 at 2:25 AM, Eva Prieto Castro wrote: > Hi, > > I have a problem in relation with a packahe I made. It runs on my machine > (Windows,

Re: [R] Problem with lm

2012-11-01 Thread Jorge I Velez
Eva, What do you get when you type ls() on the machine that the code does not run? It could be that "y" is not in that particular workspace. HTH, Jorge.- On Thu, Nov 1, 2012 at 7:25 PM, Eva Prieto Castro <> wrote: > Hi, > > I have a problem in relation with a packahe I made. It runs on my machi

[R] Problem with lm

2012-11-01 Thread Eva Prieto Castro
Hi, I have a problem in relation with a packahe I made. It runs on my machine (Windows, where I made the package), and it runs in a Mac machine, but it does not run in another Mac machine with the same R version. The part of the code is giving problems: singleCosinor <- function(t, y, period=2

Re: [R] problem with lm, and summary.lm

2008-11-16 Thread Tolga Uzuner
Many thanks Gabor, as always, much appreciated. Regards, Tolga Gabor Grothendieck wrote: R has introduced a new function xtfrm and in order for zoo to work with it there must be an xtfrm zoo method. The development version of zoo has such a method but its not yet released. Try this: xtfrm.zoo

Re: [R] problem with lm, and summary.lm

2008-11-16 Thread Gabor Grothendieck
R has introduced a new function xtfrm and in order for zoo to work with it there must be an xtfrm zoo method. The development version of zoo has such a method but its not yet released. Try this: xtfrm.zoo <- coredata and then run your code. On Sun, Nov 16, 2008 at 12:20 PM, Tolga Uzuner <[EMA

Re: [R] problem with lm, and summary.lm

2008-11-16 Thread Tolga Uzuner
Dear Gabor, Many thanks. That snippet of code also works for me (below). I am currently on 2.8.0. However, it continues to fail on the specific data I am using. I have attached the data in data.RData, attached here. If you save this file into the working directory and run the following, that

Re: [R] problem with lm, and summary.lm

2008-11-16 Thread Gabor Grothendieck
Try upgrading to R 2.8.0 patched. This works for me using R 2.8.0 patched from Nov 10th: library(zoo) z <- 1:10 x <- z*z y <- x*z lm(z ~ x + y) summary(lm(z ~ x + y)) > packageDescription("zoo")$Version [1] "1.5-4" > R.version.string # Vista [1] "R version 2.8.0 Patched (2008-11-10 r46884)" On

[R] problem with lm, and summary.lm

2008-11-16 Thread Tolga Uzuner
Dear R Users, I am having a weird problem. I have three zoo time series, foo, bar and baz. I run a simple linear regression with foo as the dependent and bar+baz as independents. Even though the regression runs fine, summary seems to fail.The code is below. I am happy to send the data along. I

Re: [R] problem with lm and predict - no predictions made

2008-07-03 Thread Keld Jørn Simonsen
an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: Keld Jørn Simonsen [mailto:[EMAIL PROTECTED] > Verzonden: donderdag 3 juli 2008 12:28 > Aan: ONK

Re: [R] problem with lm and predict - no predictions made

2008-07-03 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 03.07.2008 09:41:17: > On Wed, Jul 02, 2008 at 08:55:54PM -0500, Erik Iverson wrote: > > Hello - > > > > Keld Jørn Simonsen wrote: > > >Hi > > > > > >I have a problem with lm and predict > > > > > >I have > > > > > >us > > > [1] 2789.53 3128.43 3255.03 3536.

Re: [R] problem with lm and predict - no predictions made

2008-07-03 Thread Keld Jørn Simonsen
On Wed, Jul 02, 2008 at 08:55:54PM -0500, Erik Iverson wrote: > Hello - > > Keld Jørn Simonsen wrote: > >Hi > > > >I have a problem with lm and predict > > > >I have > > > >us > > [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 > > [9] 5103.75 5484.35 5803.08 5995.

Re: [R] problem with lm and predict - no predictions made

2008-07-02 Thread Jorge Ivan Velez
Dear Keld, See ?predict.lm and its examples. HTH, Jorge On Wed, Jul 2, 2008 at 9:40 PM, Keld Jørn Simonsen <[EMAIL PROTECTED]> wrote: > Hi > > I have a problem with lm and predict > > I have > > us > [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 > [9] 5103.75

Re: [R] problem with lm and predict - no predictions made

2008-07-02 Thread Erik Iverson
Hello - Keld Jørn Simonsen wrote: Hi I have a problem with lm and predict I have us [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 [9] 5103.75 5484.35 5803.08 5995.93 6337.75 6657.40 7072.23 7397.65 [17] 7816.83 8304.33 8746.98 9268.43 9816.98 1012

[R] problem with lm and predict - no predictions made

2008-07-02 Thread Keld Jørn Simonsen
Hi I have a problem with lm and predict I have us [1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48 [9] 5103.75 5484.35 5803.08 5995.93 6337.75 6657.40 7072.23 7397.65 [17] 7816.83 8304.33 8746.98 9268.43 9816.98 10127.95 10469.60 10960.75 [25] 11685.93 1