Hello,
Thanks for the response.
However, I have this problem with view.
> View(fit1)
Error: could not find function "View"
I have R 2.4.1 and even tried loading 'utils'.
As for saving residuals in a spreadsheet I used something like this:
res.fit1<-fit1$residuals
res.fit2<-fit2$residuals
....
write.csv(res.fit1, file="res.fit1.csv")
write.csv(res.fit2, file="res.fit2.csv")
Thanks,
M Just
On Tue, Sep 23, 2008 at 9:07 PM, Greg Snow wrote:
> The View function (note the uppercase V) is in the utils package, one of
> the standard ones that loads automatically.
> ------------------------------
> *From:* Michael Just [mgjust@gmail.com]
> *Sent:* Tuesday, September 23, 2008 2:49 PM
> *To:* Greg Snow
> *Cc:* r-help@r-project.org; NordlDJ@dshs.wa.gov
>
> *Subject:* Re: [R] Options for viewing / using results from lm
>
> Greg,
> Thanks for the pseudocode and cbind suggestions I think these should be
> quite helpful. What package is the function 'view' in? As for exporting
> elsewhere, basically I would to have the values of residuals saved in a
> spreadsheet in addition to any visualizations created within R.
>
> Thanks,
> M Just
>
> On Tue, Sep 23, 2008 at 3:26 PM, Greg Snow wrote:
>
>> You can do things like this pseudocode:
>>
>> > fit1 <- lm( y ~ x1, data=mydata )
>> > fit2 <- lm( y ~ x2, data=mydata )
>> > fit3 <- lm( y ~ x1*x2, data=mydata )
>> ...
>>
>> > mydata$r1 <- resid(fit1)
>> > mydata$r2 <- resid(fit2)
>> > mydata$r3 <- resid(fit3)
>>
>> Or
>>
>> > mydata <- cbind(mydata, r1=resid(fit1), r2=resid(fit2), ...
>>
>> To view the data in a spreadsheet like table:
>>
>> > View(mydata)
>>
>> And scroll over to the r columns, using indexing or the subset function
>> can reorder the columns to make this easier.
>>
>> A simple plot:
>>
>> > pairs( mydata[ , paste('r',1:10, sep='')], col=c('red','green','blue')[
>> mydata$g1 ],
>> + panel=panel.smooth )
>>
>> Or there are various other ways to explore the data within R. If you
>> really feel the need to use another tool, do like the above, then use
>> write.table to export it to a csv file or paste it to a spreadsheet. There
>> is also the rggobi package which will automate the exporting to the ggobi
>> program which allows a lot more visualization options.
>>
>> Hope this helps,
>>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.snow@imail.org
>> 801.408.8111
>>
>>
>> > -----Original Message-----
>> > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
>> > project.org] On Behalf Of Michael Just
>> > Sent: Tuesday, September 23, 2008 2:06 PM
>> > To: r-help@r-project.org
>> > Cc: NordlDJ@dshs.wa.gov
>> > Subject: Re: [R] Options for viewing / using results from lm
>> >
>> > Hello,
>> >
>> > >Why do you think it is better done in another program? Keeping it in R
>> > saves you from the exporting, which you say you are having trouble
>> > with.
>> >
>> > I think it might be better for viewing capabilities. If I had columns
>> > of
>> > residuals right next to each other I could spot differences amongst
>> > locations. Right? If I can take the residual values and put them back
>> > into
>> > my main data file I can then have the options to use grouping values
>> > that
>> > exist there. (Like I asked here:
>> > http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)
>> >
>> > >> Q2: How can I take the residuals and create an object(s) for further
>> > > >*
>> > analysis.
>> > *
>> > **
>> >
>> > >See ?residuals.
>> >
>> > >Try the following:
>> >
>> > >x <- sample(1:20, 100, replace=TRUE)
>> > >y <- rnorm(100)
>> > >fit.lm <- lm(y ~ x)
>> > >plot(residuals(fit.lm))
>> > >plot(x,residuals(fit.lm))
>> >
>> >
>> > When I was thinking further analysis, for example, could I take the
>> > residuals for all metrics in one extent and compare them to all
>> > residuals
>> > for all metrics in another extent? Even though the were created with 16
>> > different models?
>> >
>> > In 'plot(residuals(fit.lm))' what is the index 'counting'?
>> >
>> >
>> > Thank you kindly for you $0.25,
>> >
>> > Cheers,
>> >
>> > M Just
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > 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.
>>
>
>
[[alternative HTML version deleted]]