[R] Accessing individual variables from summary of lm

2008-07-22 Thread ascentnet

I am trying to access the R2, intercept, and slope out of the summary from an
lm so that I can insert it into a database using RODBC.  How can I access
these individually?

thanks in advance,
Ben.
-- 
View this message in context: 
http://www.nabble.com/Accessing-individual-variables-from-summary-of-lm-tp18582274p18582274.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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, self-contained, reproducible code.


Re: [R] Accessing individual variables from summary of lm

2008-07-22 Thread ascentnet

Thanks for your help!  If you wouldn't mind, how do I access the individual
components inside coefficients matrix?

thanks,
Ben.

Paul Smith wrote:
> 
> On Tue, Jul 22, 2008 at 5:44 AM, ascentnet <[EMAIL PROTECTED]> wrote:
>> I am trying to access the R2, intercept, and slope out of the summary
>> from an
>> lm so that I can insert it into a database using RODBC.  How can I access
>> these individually?
> 
> Try:
> 
> data(swiss)
> model <- lm(Infant.Mortality ~ .,data=swiss)
> summary(model)$r.square
> # The following returns a matrix with the coefficients
> summary(model)$coefficients
> 
> Paul
> 
> __
> R-help@r-project.org mailing list
> 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, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Accessing-individual-variables-from-summary-of-lm-tp18582274p18603897.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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, self-contained, reproducible code.


[R] Add a Vector to a Matrix

2008-07-26 Thread ascentnet

I know there is a very simple answer to this question, but it eludes me.  I
need to insert a vector into a matrix.  So if I have a 2 column matrix with
5 rows, I need to insert in an additional vector so there is now 6 rows
without overwriting any of the data in the matrix already.

thanks,
Ben.
-- 
View this message in context: 
http://www.nabble.com/Add-a-Vector-to-a-Matrix-tp18667839p18667839.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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, self-contained, reproducible code.


[R] Polynomial regression help

2008-08-18 Thread ascentnet

I have a simple X, Y data frame that I am trying to run regression analysis
on.  The linear regression looks great, but when I use lm(formula = y ~
poly(x, degree = 5)) I get the same coeffecients.  So for example if I use
degree =3 my formula would look like y = 4.2 x^3 + 3.2x^2 + 2.1x + 1.0 and
my degree 5 would look like y = 6.5x^5+ 5.4x^4 + 4.2 x^3 + 3.2x^2 + 2.1x +
1.0, which doesn't make sense to me.

I was wondering if someone knew what I was doing wrong or if this is
correct?

thanks,
Ben.
-- 
View this message in context: 
http://www.nabble.com/Polynomial-regression-help-tp19042447p19042447.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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, self-contained, reproducible code.


[R] Plotting multiple curves on a plot

2008-08-24 Thread ascentnet

Greetings!

I was wondering how to plot multiple equation on the same plot with the
data?

So if I have three equations: 

1.y= 2.31X + -2.2
2.y=  2.27X^2 + 5.63X + 0.52
3.y=  -1.53X^3 +  1.92X^2 + -4.72X + 4.57

and a datafram or a 2D matrix.  I would also like the equations in different
colors, but that is extra!

thanks in advance,
Ben.
-- 
View this message in context: 
http://www.nabble.com/Plotting-multiple-curves-on-a-plot-tp19132217p19132217.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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, self-contained, reproducible code.