Re: [R] Linear regression and stand deviation at the Linux command line

2024-08-23 Thread Keith Christian
Hi Ivan, Thanks for the suggestions. Will try them. Keith On Fri, Aug 23, 2024 at 1:57 AM Ivan Krylov wrote: > > В Thu, 22 Aug 2024 13:07:37 -0600 > Keith Christian пишет: > > > I'm interested in R construct(s) to be entered at the command > > line that would output slope, y-intercept

Re: [R] Linear regression and stand deviation at the Linux command line

2024-08-23 Thread Ivan Krylov via R-help
В Thu, 22 Aug 2024 13:07:37 -0600 Keith Christian пишет: > I'm interested in R construct(s) to be entered at the command > line that would output slope, y-intercept, and r-squared values read > from a csv or other filename entered at the command line, and the same > for standard deviation calcula

Re: [R] Linear regression and stand deviation at the Linux command line

2024-08-22 Thread Bert Gunter
In addition To John's comments, https://support.posit.co/hc/en-us/articles/218012917-How-to-run-R-scripts-from-the-command-line (found by searching on "Run R from the Linux Command line") is one of many resources that you might find helpful. As John said, this list can offer help to both new and

Re: [R] Linear regression and stand deviation at the Linux command line

2024-08-22 Thread Sorkin, John
Keith, I suggest you being by looking at a web page https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/lm It will introduce you to the lm function, the function that performs liner regression and the summary function which returns some of the material you are looking for. The p

Re: [R] linear regression

2018-08-07 Thread Jim Lemon
Hi Kenneth, My guess is that you have tried to send screenshots of your output and these were blocked. Try to cut and paste the output into your message. Jim On Tue, Aug 7, 2018 at 6:38 PM, John wrote: > On Mon, 6 Aug 2018 20:18:38 +0200 > kenneth Barnhoorn wrote: > > Your examples did not app

Re: [R] linear regression

2018-08-07 Thread John
On Mon, 6 Aug 2018 20:18:38 +0200 kenneth Barnhoorn wrote: Your examples did not appear. Remember to use plain text rather than html. JWDougherty > I have a problem with a linear regression output. > > In January I made an analysis of some data and received an certain > output, if I run the

Re: [R] linear regression with repeated measures

2018-04-09 Thread Bert Gunter
Generally, statistics questions are off topic here, although they do sometimes intersect R programming issues, as perhaps here. Nevertheless, I believe your post would fit better on the r-sig-mixed-models list, where repeated measures and other mixed effects (/variance components) models are discus

Re: [R] Linear regression with tranformed dependant variable

2017-10-24 Thread Michael Friendly
Step back a minute: normality is NOT required for predictors in a multiple regression model, though the sqrt(x) transformation may also make the relationship more nearly linear, and linearity IS assumed when you fit a simple model such as y ~ x + w + z. (Normality is only required for the residu

Re: [R] Linear regression with tranformed dependant variable

2017-10-23 Thread John C Frain
Before going to stackexchange you should consider if a square root transformation is appropriate for the model that you are trying to estimate. If you do so, you may be able to interpret the coefficients yourself. If no explanation is obvious you probably should not be using a square root transform

Re: [R] Linear regression with tranformed dependant variable

2017-10-23 Thread Rui Barradas
Hello, R-Help answers questions on R code, your question is about statistics. You should try posting the question to https://stats.stackexchange.com/ Hope this helps, Rui Barradas Em 23-10-2017 18:54, kende jan via R-help escreveu: Dear all, I am trying to fit a multiple linear regression

Re: [R] Linear regression with a rounded response variable

2015-10-22 Thread Doran, Harold
> Yes, and I think that the suggestion in another post to look at censored > regression is more in the right direction. I think this is right and perhaps the best (or at least better) pathway to pursue than considering this within the framework of measurement error (ME). Of course there *is* M

Re: [R] Linear regression with a rounded response variable

2015-10-22 Thread Ravi Varadhan
: Ravi Varadhan; r-help@r-project.org Subject: Re: [R] Linear regression with a rounded response variable > On 21 Oct 2015, at 19:57 , Charles C. Berry wrote: > > On Wed, 21 Oct 2015, Ravi Varadhan wrote: > >> [snippage] > > If half the subjects have a value of 5 second

Re: [R] Linear regression with a rounded response variable

2015-10-22 Thread Jim Lemon
Hi Ravi, And remember that the vanilla rounding procedure is biased upward. That is, an observation of 5 actually may have ranged from 4.5 to 5.4. Jim On Thu, Oct 22, 2015 at 7:15 AM, peter salzman wrote: > here is one thought: > > if you plug in your numbers into any kind of regression you wil

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread peter dalgaard
> On 21 Oct 2015, at 19:57 , Charles C. Berry wrote: > > On Wed, 21 Oct 2015, Ravi Varadhan wrote: > >> [snippage] > > If half the subjects have a value of 5 seconds and the rest are split between > 4 and 6, your assertion that rounding induces an error of > dunif(epsilon,-0.5,0.5) is surely

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread peter salzman
here is one thought: if you plug in your numbers into any kind of regression you will get prediction that are real numbers and not necessarily integers, it may be that you predictions are good enough with this approximate value of Y. you could test this by randomly shuffling your data by +- 0.5 an

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread Gabor Grothendieck
This could be modeled directly using Bayesian techniques. Consider the Bayesian version of the following model where we only observe y and X. y0 is not observed. y0 <- X b + error y <- round(y0) The following code is based on modifying the code in the README of the CRAN rcppbugs R package.

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread Victor Tian
Hi Ravi, Thanks for this interesting question. My thoughts are given below. If you believe the rounding is indeed uniformly distributed, then the problem is equivalent with adding a uniform random error between (-0.5, 0.5) for every observation in addition to the standard normal error, which will

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread Charles C. Berry
On Wed, 21 Oct 2015, Ravi Varadhan wrote: Hi, I am dealing with a regression problem where the response variable, time (second) to walk 15 ft, is rounded to the nearest integer. I do not care for the regression coefficients per se, but my main interest is in getting the prediction equation fo

Re: [R] Linear regression of 0/1 response ElemStatLearn (Fig. 2.1 the elements of statistical learning)

2014-09-01 Thread David L Carlson
This is a list for R questions, not statistics or algebra, but if you set g=.5 and solve the linear model for x2 (ignore e), you will have your answer, eg: .5 = B1 + B2*X1 + B3*X2 where B1, 2, 3 are the three coefficients of the linear model, coef()[1], [2], [3]. --

Re: [R] Linear Regression Warning after plot: NaNs produced in

2014-06-29 Thread William Dunlap
One way to see where the first warning comes from is to turn warnings into errors with options(warn=2) and when the error happens call traceback(). Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Jun 29, 2014 at 4:12 AM, wat tele wrote: > > > > Hello, > > I'm a R beginner and I want to make

Re: [R] Linear Regression line equation

2013-09-04 Thread Sarah Goslee
summary(lm(Canopy_Height~Ground_Elevation, data=young400_1)) #use data= instead of attach! Or even mylm <- lm(Canopy_Height~Ground_Elevation, data=young400_1) mylm summary(mylm) coefficients(mylm) Most intro to R guides cover the basics of modeling; you might benefit from reading one of them. S

Re: [R] Linear regression repeat for each column

2013-07-20 Thread arun
Hi, set.seed(28) dat1<- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10)) set.seed(49) dat2<- as.data.frame(matrix(sample(40:80,100,replace=TRUE),ncol=10))  lapply(seq_len(ncol(dat1)),function(i) {lm(dat2[,i]~dat1[,i])}) A.K. - Original Message - From: iza.ch1 To: r-help@r-pr

Re: [R] Linear regression repeat for each column

2013-07-20 Thread Jeff Newmiller
Sure. Read the Posting Guide, and provide a reproducible example with sample data. I suspect the basic idea will be to merge the data frames and then setup the model to refer to the desired columns. --- Jeff Newmiller

Re: [R] Linear regression on dataframe's sample

2012-11-02 Thread Hard Core
I fount out a solution ... check it out random_sample = function (dt, sample_size) { # determine the number of records in the data frame length_dt = length (dt[,1]) # extract the sample dt [sample (1:length_dt, size = sample_size),] } -- View this message in context: http://r.789

Re: [R] Linear regression

2012-03-19 Thread Bert Gunter
Note that your equations can be written: y = alpha*A + (1-alpha)*B, which is equivalent to y = (A-B) * alpha + B , i.e. of form y = C*alpha + B a simple linear equation in alpha You have two different values of alpha at which y was measured, so just stack up all your results into a single

Re: [R] Linear regression

2012-03-19 Thread Niloofar Javanrouh
To: Diviya Smith Cc: r-help@r-project.org Sent: Monday, March 19, 2012 11:32 PM Subject: Re: [R] Linear regression 1. Homework assignment? We don't do homework here. 2. If not, a mixture model of some sort?  I suggest you state the context of the problem more fully. R has several package

Re: [R] Linear regression

2012-03-19 Thread Diviya Smith
Hello Bert, This is definitely not for a homework problem. I am trying to estimate frequencies of mutations in different groups. The mutation frequencies can be modeled as a linear relation in cases of mixtures. So I have a lot of populations that follow the relationship - y = alpha*A + beta*B an

Re: [R] Linear regression

2012-03-19 Thread Bert Gunter
1. Homework assignment? We don't do homework here. 2. If not, a mixture model of some sort? I suggest you state the context of the problem more fully. R has several packages to do mixture modeling, if that's what you're trying to do. 3. In any case, this cannot be done with lm() (at least withou

Re: [R] linear regression by column

2012-03-01 Thread Filoche
Thank everyone for your help. Problem solved. I'm getting more used with vectorization with your help, Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/linear-regression-by-column-tp4432564p4434937.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] linear regression by column

2012-02-29 Thread Peter Ehlers
On 2012-02-29 15:45, David Winsemius wrote: On Feb 29, 2012, at 6:39 PM, David Winsemius wrote: On Feb 29, 2012, at 1:53 PM, Filoche wrote: Hi everyone. I have a DF with the first column being my independant variable and all other columns the dependent variables. Something like: x

Re: [R] linear regression by column

2012-02-29 Thread David Winsemius
On Feb 29, 2012, at 6:39 PM, David Winsemius wrote: On Feb 29, 2012, at 1:53 PM, Filoche wrote: Hi everyone. I have a DF with the first column being my independant variable and all other columns the dependent variables. Something like: x y1 y2 y3 ... ... ...

Re: [R] linear regression by column

2012-02-29 Thread David Winsemius
On Feb 29, 2012, at 1:53 PM, Filoche wrote: Hi everyone. I have a DF with the first column being my independant variable and all other columns the dependent variables. Something like: x y1 y2 y3 ... ... ... ... ... ... ... ... What I'm trying to do

Re: [R] Linear regression using matrices

2012-01-04 Thread Mark Sanderson
OK thanks. In my case I think it might be possible to work around this by reshaping my data and then using lmlist() to run separate regressions for each data group. lmlist() is new to me but it looks like it will do the job. -- View this message in context: http://r.789695.n4.nabble.com/Linear-

Re: [R] Linear regression using matrices

2012-01-04 Thread iliketurtles
I've done a lot of research on this very topic and found a few solutions. But all the ways I've discovered involve loops. Applying it to what you want, the best way I've found is to do (stolen from an experienced R user, of course): y<-array(rnorm(100),dim=c(10,10)) x<-array(rnorm(100),dim=c(10,1

Re: [R] Linear Regression with Linear Equality Constraint

2011-10-31 Thread Mehmet Suzen
I think Alabama package on CRAN can do this; http://cran.r-project.org/web/packages/alabama/index.html >-Original Message- >From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >On Behalf Of JW >Sent: 31 October 2011 17:57 >To: r-help@r-project.org >Subject: [R] Linear

Re: [R] Linear Regression with Linear Equality Constraint

2011-10-31 Thread Comcast
On Oct 31, 2011, at 5:12 PM, Comcast wrote: > > > On Oct 31, 2011, at 3:31 PM, Bert Gunter wrote: > >> Well, if I understand the question correctly (following the posting guide >> would have spared guessing, as usual), forget packages -- nothing more than >> elementary algebra is needed. >>

Re: [R] Linear Regression with Linear Equality Constraint

2011-10-31 Thread Comcast
On Oct 31, 2011, at 3:31 PM, Bert Gunter wrote: > Well, if I understand the question correctly (following the posting guide > would have spared guessing, as usual), forget packages -- nothing more than > elementary algebra is needed. > > e.g. > > lm(y ~ x1 + x2 + x3) subject to the constrain

Re: [R] Linear Regression with Linear Equality Constraint

2011-10-31 Thread Bert Gunter
Well, if I understand the question correctly (following the posting guide would have spared guessing, as usual), forget packages -- nothing more than elementary algebra is needed. e.g. lm(y ~ x1 + x2 + x3) subject to the constraint beta_2 = beta_3, the coefficients of x2 and x3, is the same as

Re: [R] Linear Regression with Linear Equality Constraint

2011-10-31 Thread Kristian Lind
I believe the package systemfit can help you with that. Haven't tried it myself, but give it a go. Regards, Kristian 2011/10/31 JW > Please advice on the package I should use to run a linear regression model > (weighted least squared) with linear equality constraint. I initially > tried > "co

Re: [R] Linear regression interaction terms

2011-09-19 Thread Ben Bolker
Andrey A gmail.com> writes: > > Hello I performed a linear regression, my equation is Y = âo+ â1A + â2B + > â3AB. > Is there a way to separate interaction terms, say â3AB and plot it against a > certain variable? > Thanks, Andrew Not quite sure what you mean here. Possibly something like L1

Re: [R] linear regression, log-transformation and plotting

2011-09-07 Thread John C Frain
I think that you have not understood your lecturer. You can log transform any positive number. You can not log transform a negative number. Adding a constant to a negative number to make it constant before log transformation is sometimes suggested by those who do not understand what they are doin

Re: [R] Linear Regression with 2 grouping variables

2011-08-23 Thread Nathan Miller
Thanks Dennis! Worked perfectly. I keep forgetting that plyr can split data based on multiple subsetting variables. Thanks so much, Nate On Mon, Aug 22, 2011 at 10:12 PM, Dennis Murphy wrote: > Hi: > > You're kind of on the right track, but there is no conditioning > formula in lm(); it's not l

Re: [R] Linear Regression with 2 grouping variables

2011-08-23 Thread Michael Dewey
At 02:15 23/08/2011, Nathan Miller wrote: Hi all, See comment in-line I have a data set that looks a bit like this. feed1 RFU Site Vial Time lnRFU 1 811 10 10.702075 2 4752111 20 10.768927 3 4290511 30 10.66674 4 4686711 40

Re: [R] Linear Regression with 2 grouping variables

2011-08-22 Thread Dennis Murphy
Hi: You're kind of on the right track, but there is no conditioning formula in lm(); it's not lattice :) This is relatively easy to do with the plyr package, though: library('plyr') # Generate a list of models - the subsetting variables (Site, Vial) are # used to generate the data splits and the

Re: [R] Linear Regression with 2 grouping variables

2011-08-22 Thread Weidong Gu
You can do something like this sp<-split(dat, list(dat$Vial,dat$Site)) seq.model<-lapply(sp, function(x) lm(x$InRFU~x$Time)) Then, extract whatever you want from seq.model Weidong Gu On Mon, Aug 22, 2011 at 9:15 PM, Nathan Miller wrote: > Hi all, > > I have a data set that looks a bit li

Re: [R] linear regression

2011-08-13 Thread Mikhail Titov
Don't forget to load `lattice` package. `latticeExtra` with `panel.ablineeq` can be also helpful. This was however for plotting. For subset regression by each WR without plotting you'd use something like `lapply` or `sapply`. ans <- sapply(unique(data$WR), function(dir) { out <- list(lm(PM10~

Re: [R] linear regression

2011-08-13 Thread Dennis Murphy
Hi: Try something like this, using dat as the name of your data frame: xyplot(PM10 ~ Ref | WR, data = dat, type = c('p', 'r')) The plot looks silly with the data snippet you provided, but should hopefully look more sensible with the complete data. The code creates a four panel plot, one per dire

Re: [R] linear regression

2011-08-13 Thread Steven Kennedy
your dataframe needs to be called "Nord". If it is not, then replace "Nord" with the actual name of your dataframe On Sat, Aug 13, 2011 at 10:43 PM, maggy yan wrote: > dear R users, > my data looks like this > >         PM10       Ref   UZ     JZ         WT   RH   FT   WR > 1   10.973195  4.338

Re: [R] linear regression in a ragged array

2011-03-22 Thread Greg Snow
In general when you want to split up your data and do the same thing on each piece then combine the results back together it is good to look at the plyr package. But for this specific case you should look at the lmList function in the nlme package which may do exactly what you want with the lea

Re: [R] linear regression in a ragged array

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 5:25 AM, Marcel Curlin wrote: Hello, I have a large dataset of the form subj var1 var2 001100200 001120226 001130238 001140245 001150300 002110205 002125209 003101233 003115254 I would like to perf

Re: [R] linear regression in a data.frame using recast -- A fortunes candidate??

2011-03-16 Thread Abhijit Dasgupta, PhD
Seconded On 03/16/2011 05:37 PM, Bert Gunter wrote: Ha! -- A fortunes candidate? -- Bert If this is really a time series, then you will have serious validity problems due to auto-correlation among non-independent units. (But if you are just searching for a way to pull the wool over the eyes of

Re: [R] linear regression in a data.frame using recast -- A fortunes candidate??

2011-03-16 Thread Bert Gunter
Ha! -- A fortunes candidate? -- Bert > > If this is really a time series, then you will have serious validity > problems due to auto-correlation among non-independent units. (But if you > are just searching for a way to pull the wool over the eyes of the > statistically uninformed, then I guess th

Re: [R] linear regression in a data.frame using recast

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 3:19 PM, Justin Haynes wrote: I have a very large dataset with columns of id number, actual value, predicted value. This used to be a time series but I have dropped the time component. So I now have a data.frame where the id number is repeated but each value in the actual

Re: [R] linear regression and t-distribution

2011-02-22 Thread Peter Ehlers
On 2011-02-21 02:42, Rosario Garcia Gil wrote: Hello I have a data set with outlier and it is not normally distributed. I would instead like to use a more robust distribution like t-distribution. My question is if the coefficients of the regression are different from zero, but assuming a t-di

Re: [R] linear regression and t-distribution

2011-02-22 Thread Kjetil Halvorsen
did you try RSiteSearch("t-regression") ? That seems to give some usefull hits. On Mon, Feb 21, 2011 at 7:42 AM, Rosario Garcia Gil wrote: > Hello > > I have a data set with outlier and it is not normally distributed. I would > instead like to use a more robust distribution like t-distribution

Re: [R] linear regression for grouped data

2010-12-30 Thread Michael Dewey
At 02:23 29/12/2010, Entropi ntrp wrote: Hi, I have been examining large data and need to do simple linear regression with the data which is grouped based on the values of a particular attribute. For instance, consider three columns : ID, x, y, and I need to regress x on y for each distinct val

Re: [R] linear regression for grouped data

2010-12-29 Thread entropy
Thanks alot for the quick responses. I have some additional questions related to this topic. In fact, my intention was to be able to answer questions like what percent of the regressions have p_values less than a certain threshold, how do residuals look like, how do the plots of y vs. x look like,

Re: [R] linear regression for grouped data

2010-12-28 Thread Dennis Murphy
Hi: There are some advantages to taking a plyr approach to this type of problem. The basic idea is to fit a linear model to each subgroup and save the results in a list, from which you can extract what you want piece by piece. library(plyr) # One of those SAS style data sets... > df <- data.fram

Re: [R] linear regression for grouped data

2010-12-28 Thread Bill.Venables
library(nlme) lmList(y ~ x | factor(ID), myData) This gives a list of fitted model objects. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Entropi ntrp Sent: Wednesday, 29 December 2010 12:24 PM To: r-help@r-project.org Subject:

Re: [R] linear regression for grouped data

2010-12-28 Thread David Winsemius
On Dec 28, 2010, at 9:23 PM, Entropi ntrp wrote: Hi, I have been examining large data and need to do simple linear regression with the data which is grouped based on the values of a particular attribute. For instance, consider three columns : ID, x, y, and I need to regress x on y for ea

Re: [R] linear regression with dates

2010-12-27 Thread David Winsemius
On Dec 27, 2010, at 8:56 PM, Entropi ntrp wrote: Thanks for the response. I proivded the necessary details below, and also have a general question for how to deal with dates in R. Is there a way to make R read dates as numbers? Here is the details of the R code: egfr <- read.csv(file.ch

Re: [R] linear regression with dates

2010-12-27 Thread Entropi ntrp
Thanks for the response. I proivded the necessary details below, and also have a general question for how to deal with dates in R. Is there a way to make R read dates as numbers? Here is the details of the R code: egfr <- read.csv(file.choose(), header=TRUE, sep=",") #egfr is a matrix read fr

Re: [R] linear regression with dates

2010-12-27 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Entropi ntrp > Sent: Monday, December 27, 2010 3:05 PM > To: r-help@r-project.org > Subject: [R] linear regression with dates > > Hi, > I am trying to do simple linear regression

Re: [R] Linear Regression

2010-10-12 Thread David Winsemius
On Oct 12, 2010, at 9:01 AM, Vittorio Colagrande wrote: Dear R-group, We have begun to use it for teaching Statistics. In this context we have run into a problem with linear regression where we found the results of are confusing. Specifically, considering the data: x=c(4,5,6,3,7,8,10,14,

Re: [R] Linear Regression

2010-10-12 Thread ONKELINX, Thierry
Dear Vittorio, Notice that anova(regress) gives a warning: ANOVA F-tests on an essentially perfect fit are unreliable Maybe summary(regress) should give a similar warning in case of a perfect fit. Allthough you should notice that the residual standard error displayed by summary() is extremly smal

Re: [R] Linear regression equation and coefficient matrix

2010-08-19 Thread Greg Snow
[mailto:r-help-boun...@r- > project.org] On Behalf Of ashz > Sent: Thursday, August 19, 2010 3:02 AM > To: r-help@r-project.org > Subject: Re: [R] Linear regression equation and coefficient matrix > > > Dear Greg, > > Thanks for the tip. As I am new in R can you please provide me

Re: [R] Linear regression equation and coefficient matrix

2010-08-19 Thread ashz
Dear Greg, Thanks for the tip. As I am new in R can you please provide me a script how do to so. It will help my learning process. Thanks, Asher -- View this message in context: http://r.789695.n4.nabble.com/Linear-regression-equation-and-coefficient-matrix-tp2329804p2330867.html Sent from the

Re: [R] Linear regression equation and coefficient matrix

2010-08-18 Thread Greg Snow
hz > Sent: Wednesday, August 18, 2010 8:43 AM > To: r-help@r-project.org > Subject: Re: [R] Linear regression equation and coefficient matrix > > > Hi, > > Thanks, the cor() works. > > Regarding the simple linear regression equation (mainly, the slope > parameter) an

Re: [R] Linear regression equation and coefficient matrix

2010-08-18 Thread ashz
Hi, Thanks, the cor() works. Regarding the simple linear regression equation (mainly, the slope parameter) and r2. I think I was not writing it well. I need to do it just for the columns. If I have a, b, c, d columns I wish to compute the relation of there data, e.g., between a-b, a-c, a-d, b-a

Re: [R] Linear regression equation and coefficient matrix

2010-08-18 Thread Joshua Wiley
Hmm, after reading one of your other posts, I am thinking you may *just* want all pairwise combinations. This worked for me: # Create a sample data frame with 60 named columns x <- data.frame(matrix(rnorm(1200), ncol = 60, dimnames = list(NULL, paste("Col", 1:60, sep='' # calculate the corre

Re: [R] Linear regression equation and coefficient matrix

2010-08-18 Thread Joshua Wiley
On Wed, Aug 18, 2010 at 6:09 AM, ashz wrote: > > Hi, > > I have 20*60 data matrix (with some NAs) and I wish to perfom a  Pearson > correlation coefficient matrix as well as simple linear regression equation The correlation matrix can be readily obtained by calling cor() on the entire matrix. >

Re: [R] Linear regression on several groups

2010-08-13 Thread Derek Ogle
Have a look at lmList() in the nlme package. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of JesperHybel > Sent: Friday, August 13, 2010 7:56 AM > To: r-help@r-project.org > Subject: Re: [R] Linear reg

Re: [R] Linear regression on several groups

2010-08-13 Thread JesperHybel
Example is spot on - sr for not providing one myself. The results you calculate are what I'm looking for. Would like a function F where I could type: F(weight ~ Time, data = ChickWeight, SOME ARGUMENT = Diet)) Resulting in for (i in 1:4){ print( lm(weight ~ Time, data = ChickWeight, subset =

Re: [R] Linear regression on several groups

2010-08-13 Thread Eik Vettorazzi
hi, maybe an ANCOVA is what you want, which is also done by lm in R lm(y~x*z) Am 12.08.2010 17:11, schrieb JesperHybel: > > I have a simple dataset of a numerical dependent Y, a numerical independent X > and a categorial variable Z with three levels. I want to do linear > regression Y~X for ea

Re: [R] Linear regression on several groups

2010-08-13 Thread Allan Engelhardt
Please read the posting guide and include a standalone example. Maybe you want something like the results from lm(weight ~ Time, data = ChickWeight, subset = Diet==1) lm(weight ~ Time, data = ChickWeight, subset = Diet==2) ## ... etc ... Then you could do (m <- lm(weight ~ Time*Diet, data = C

Re: [R] Linear regression - R^2

2010-01-09 Thread milton ruser
Dear Csanad, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html Reproducible code/problem are welcome. By the way, who you believe is right? bests milton On Sat, Jan 9, 2010 at 5:40 PM, Csanád Bertók wrote: > Hello, > > I wa

Re: [R] linear regression on groups of consecutive rows of a matrix

2009-11-24 Thread Jim Bouldin
> But I do feel compelled to ask: Do you really get meaningful > information from lm applied to 5 cases? Especially when the predictors > used may not be the same from subset to subset??? Thanks again for your help David. Your question is a good one. It's a bit complicated but here's the bas

Re: [R] linear regression on groups of consecutive rows of a matrix

2009-11-24 Thread David Winsemius
Perhaps along these lines: 1st #need to decide what your group width is , so the second number inside the extraction call will be that number minus 1: for (x in seq(1:1000, by=6) { temp <- na,omit( shp[x:(x+5), ] ) # Need the parens in x:(x+5) lm( formula, data=temp) } Or dependi

Re: [R] linear regression: Is there a way to get the results of lm as variables

2009-10-21 Thread Jorge Ivan Velez
Hi CE.KA, Take a look at the following: # Data set.seed(123) x <- rnorm(100) y <- 2 + 1.5*x + rnorm(100) # Regression model reg <- lm(y ~ x) # The summary summary(reg) # Objects present in the summary() names(summary(reg)) # Extracting the coefficients summary(reg)$coeff HTH, Jorge On Wed,

Re: [R] linear regression: Is there a way to get the results of lm as variables

2009-10-21 Thread Achim Zeileis
On Wed, 21 Oct 2009, CE.KA wrote: Hi R users I used R to get the results of a linear regression reg<-lm(y~x) here are the results: # Call: # lm(formula = donnees$txi7098 ~ donnees$txs7098) # # Residuals: # Min1QMedian3Q Max # -0.037971 -0.013373 -0.004947

Re: [R] Linear Regression Question

2009-10-14 Thread Peter Ehlers
Alexandre, Let me add two small points to Ted's exposition: 1. you can use the extractor function coefficients(), or just coef() on the summary: coef(summary(regression)) which will also give you the matrix of estimates, etc. 2. You will find that using the function str() often is

Re: [R] Linear Regression Question

2009-10-14 Thread Ted Harding
On 13-Oct-09 21:17:11, Alexandre Cohen wrote: > Dear Sir or Madam, > I am a student at MSc Probability and Finance at Paris 6 University/ > Ecole Polytechnique. I am using R and I can't find an answer to the > following question. I will be very thankful if you can answer it. > > I have two vect

Re: [R] Linear Regression Question

2009-10-14 Thread Jakson A. Aquino
On Tue, Oct 13, 2009 at 11:17:11PM +0200, Alexandre Cohen wrote: > I have two vectors rendements_CAC40 and rendements_AlcatelLucent. > I use the lm function as follows, and then the sumarry function: > > regression=lm(rendements_CAC40 ~ rendements_AlcatelLucent); > sum=summarry(regression); [...]

Re: [R] linear regression, exclude a datum

2009-09-15 Thread Uwe Ligges
e-letter wrote: On 15/09/2009, Uwe Ligges wrote: e-letter wrote: On 14/09/2009, Steve Lianoglou wrote: Hi, On Sep 14, 2009, at 9:47 AM, e-letter wrote: Readers, I have been reading the r book (Crawley) and tried to use the influence measures function for linear regression, as describe

Re: [R] linear regression, exclude a datum

2009-09-15 Thread e-letter
On 15/09/2009, Uwe Ligges wrote: > > > e-letter wrote: >> On 14/09/2009, Steve Lianoglou wrote: >>> Hi, >>> >>> On Sep 14, 2009, at 9:47 AM, e-letter wrote: >>> Readers, I have been reading the r book (Crawley) and tried to use the influence measures function for linear regres

Re: [R] linear regression, exclude a datum

2009-09-15 Thread Uwe Ligges
e-letter wrote: On 14/09/2009, Steve Lianoglou wrote: Hi, On Sep 14, 2009, at 9:47 AM, e-letter wrote: Readers, I have been reading the r book (Crawley) and tried to use the influence measures function for linear regression, as described. I have one datum that I wish to show in the graph

Re: [R] linear regression, exclude a datum

2009-09-14 Thread e-letter
On 14/09/2009, Steve Lianoglou wrote: > Hi, > > On Sep 14, 2009, at 9:47 AM, e-letter wrote: > >> Readers, >> >> I have been reading the r book (Crawley) and tried to use the >> influence measures function for linear regression, as described. I >> have one datum that I wish to show in the graph bu

Re: [R] linear regression, exclude a datum

2009-09-14 Thread Steve Lianoglou
Hi, On Sep 14, 2009, at 9:47 AM, e-letter wrote: Readers, I have been reading the r book (Crawley) and tried to use the influence measures function for linear regression, as described. I have one datum that I wish to show in the graph but exclude from the regression and ab line. x y 0

Re: [R] Linear Regression Problem

2009-07-14 Thread Alex Roy
_pages/Varadhan.h > tml > > > > > > > > > -Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf Of Alex Roy > Sent

Re: [R] Linear Regression Problem

2009-07-14 Thread Ravi Varadhan
(UniPa) Cc: r-help@r-project.org Subject: Re: [R] Linear Regression Problem Dear Vito, Thanks for your comments. But I want to do Simple linear regression not Multiple Linear regression. Multiple Linear regression is not possible here as number of variables are much more than samples.

Re: [R] Linear Regression Problem

2009-07-14 Thread Liaw, Andy
y)) Andy > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Alex Roy > Sent: Tuesday, July 14, 2009 11:29 AM > To: Vito Muggeo (UniPa) > Cc: r-help@r-project.org > Subject: Re: [R] Linear Regression Problem > >

Re: [R] Linear Regression Problem

2009-07-14 Thread Alex Roy
Dear Vito, Thanks for your comments. But I want to do Simple linear regression not Multiple Linear regression. Multiple Linear regression is not possible here as number of variables are much more than samples.( X is ill condioned, inverse of X^TX does not exist! ) I just want to tak

Re: [R] Linear Regression Problem

2009-07-14 Thread Vito Muggeo (UniPa)
dear Alex, I think your problem with a large number of predictors and a relatively small number of subjects may be faced via some regularization approach (ridge or lasso regression..) hope this helps you, vito Alex Roy ha scritto: Dear All, I have a matrix say, X ( 100 X 40

Re: [R] linear regression and testing the slope

2009-07-08 Thread Ted Harding
On 08-Jul-09 12:29:40, evrim akar wrote: > Dear All, > First of all I would like to say I do not have much knowledge > about this subject, so most of you can find it really easy. > I am doing a linear regression and I want to test if the slope > of the curve is 0. R gives the summary statistics: >

Re: [R] Linear Regression with Constraints

2009-05-27 Thread Emmanuel Charpentier
Le mercredi 27 mai 2009 à 17:28 +1000, bill.venab...@csiro.au a écrit : > You can accommodate the constraints by, e.g., putting > > c2 = pnorm(theta2) > c3 = pnorm(theta3) Nice. I'd have tried invlogit(), but I'm seriously biased... > x1 has a known coefficient (unity) so it becomes an offset. >

Re: [R] Linear Regression with Constraints

2009-05-27 Thread Bill.Venables
-project.org] On Behalf Of Emmanuel Charpentier [charp...@bacbuc.dyndns.org] Sent: 27 May 2009 17:05 To: r-h...@stat.math.ethz.ch Subject: Re: [R] Linear Regression with Constraints Le mardi 26 mai 2009 à 14:11 -0400, Stu @ AGS a écrit : > Hi! > I am a bit new to R. > I am looking for the right

Re: [R] Linear Regression with Constraints

2009-05-27 Thread Emmanuel Charpentier
Le mardi 26 mai 2009 à 14:11 -0400, Stu @ AGS a écrit : > Hi! > I am a bit new to R. > I am looking for the right function to use for a multiple regression problem > of the form: > > y = c1 + x1 + (c2 * x2) - (c3 * x3) > > Where c1, c2, and c3 are the desired regression coefficients that are > su

Re: [R] Linear Regression with Constraints

2009-05-26 Thread Ravi Varadhan
Here is a demonstration of how to solve your problem : n <- 30 # You might need more than 6 data points to get good estimates for 3 parameters x1 <- rnorm(n) x2 <- runif(n) x3 <- rbinom(n, size=1, prob=0.4) A <- cbind(x1, x2, x3) # 30 x 3 matrix of independent variables b <- c(-1, 0.5, 0.2)

Re: [R] Linear Regression

2009-03-06 Thread Jorge Ivan Velez
Dear Sueli, Assuming that your data is in a data frame called "mydata", something like the following should work: # splitting the data by SAMPLE msp<-with(mydata,split(mydata,SAMPLE)) # linear models by sample models<-lapply(msp,function(x) lm(KA ~ PA, data = x)) # linear models by sample model

Re: [R] Linear Regression

2009-03-06 Thread Douglas Bates
On Fri, Mar 6, 2009 at 6:07 AM, Sueli Rodrigues wrote: > > Hi, I have the following file, and I need to work out the linear > regression for each sample. I tried the model(*) and receive the error > message (**): >> data=split(mydata,rep(1:(nrow(mydata)/6),each=6)) >> arrang.linear=lapply(data,lm,

  1   2   >