similar to: Quick question about lm()

Displaying 20 results from an estimated 40000 matches similar to: "Quick question about lm()"

2008 Jul 07
3
A quick question about lm()
I have a simple regression using lm(). If I just want to check the coefficient, I can use summary(lm())$coef; if I need the standard error, I can use summary(lm())$s, if I need the residuals, I can use summary(lm())$res. OK. How can I get the R-squares and Adjusted R-squares using $...? Is there a function, like objects(), that can show all the references for values? Thanks a lot! -- View this
2007 Jan 09
4
A question about R environment
Hi all, I created environment "mytoolbox" by : mytoolbox <- new.env(parent=baseenv()) Is there anyway I put it in the search path ? If you need some background : In a project, I often write some small functions, and load them into my workspace directly, so when I list the objects with ls(), it looks pretty messy. So I am wondering if it is possible to creat an
2007 Mar 09
2
understanding print.summary.lm and perhaps print/show in general
I'm trying to understand how R prints summary.lm objects and trying to change it slightly for a summary function that calculates standard errors using an alternative method. I've found that I can modify a summary.lm object and then it prints the modified way but I want to change a few things in the print method that I think I might just be able to do. One is that I want the coefficients
2007 Feb 02
2
A question about dput
Hi, I am trying to output a R data set for use in WinBugs, I used dput(list(x=rnorm(100),N=100),file="bug.dat") But I can't get the intended format: list(x=c(.......),N=100), instead, I got something like this (copied the first two lines): [00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?78???? structure(list(x
2006 Apr 17
1
interaction terms in formula of lm or glm
I would like to include pairwise interaction terms for lm(). For example, I want to include the quadratic term of variable "V3". > my.formula y ~ 1 + V1 + V3 + V3:V3 > my.data y V1 V2 V3 1 31 1 42 140 2 32 0 43 120 3 33 0 57 150 4 34 0 55 132 > foo <- lm(my.formula, data = my.data) > foo$coefficients (Intercept) V1 V3 29.47368421 -2.15789474
2006 Sep 27
2
How to pass expression as an argument
Hi, I am writing a function and need to pass a function expression as an argument, for instance, myfun <- function( express) { x<- c(1,2,3) y<-express } if I call the above function by myfun( x*2 ), I get 2 as the result, instead of 2,4,6 , could someone help me to fix this problem ? Furthermore, is that
2007 Jan 14
1
Questions about paste and assign
Hi, I would like to assign a value to a member b of the list a in position 3, by calling: assign( target, 2.34, 3) My question is what the "target" should be. I tried target <- paste("a", $, "b") and something else, but haven't got the right answer yet. BTW, if I attached a list named
2007 Mar 28
3
multi-level modeling & R?
A colleague was asking me if R does multi-level modelling as opposed to multiple regression. Since I have no knowledge of multi-level modelling (except 5 minutes googling ) I thought that I would as here. Does are offer any multi-level modeling packages? It looked like arm might be one but I was not sure. Thanks
2009 Oct 21
2
linear regression: Is there a way to get the results of lm as variables
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: # Min 1Q Median 3Q Max #
2005 Jul 21
1
Question about 'text' (add lm summary to a plot)
I would like to annotate my plot with a little box containing the slope, intercept and R^2 of a lm on the data. I would like it to look like... +----------------------------+ | Slope : 3.45 +- 0.34 | | Intercept : -10.43 +- 1.42 | | R^2 : 0.78 | +----------------------------+ However I can't make anything this neat, and I can't find out how to combine this
2009 Feb 28
3
Extract statistics from lm()
Hi, perhaps this question was answered previously however I could not find them. My problem is how how to extract a particular statistic from the result given by lm(). For e.g. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2,10,20, labels=c("Ctl","Trt")) weight <- c(ctl, trt) >
2005 Dec 09
3
retrieving p-values in lm
Dear list, I want to retrieve the p-value of a two-polynomial regression. For a one-polynomial lm I can easily do this with: summary(lm(b~a, data=c)[[4]][[8]]. But how do I find the final p-value in the two-polynomial regression? Under $coefficients I don't find it Any suggestions? Patrick alt <-(2260,2183,2189,1930,2435, 2000,2100,2050,2020,2470, 1700,2310,2090,1560,2060,
2009 Apr 05
4
extract the p value of F statistics from the lm class
Dear R users I have run an regression and want to extract the p value of the F statistics, but I can find a way to do that. x<-summary(lm(log(RV2)~log(IV.m),data=b)) Call: lm(formula = log(RV2) ~ log(IV.m), data = b[[11]]) Residuals: Min 1Q Median 3Q Max -0.26511 -0.09718 -0.01326 0.11095 0.29777 Coefficients: Estimate Std. Error t value Pr(>|t|)
2005 Jun 28
2
How to import data as numeric array?
Did some search but couldn't find useful result. I am trying to read a n*m dimension data with read.table, what i need is a numeric array, is there any efficient way to allow me get this array directly instead of a list? I tried to use as.array() to change the mode, but seems it doesn't work and i got this error message: "Error in "dimnames<-.data.frame"(`*tmp*`,
2008 Oct 31
3
getting the p-value from lm as a list object
Hi, I'm trying to get the p-value from the 'lm' regression function as a list object. For example, I can get r^2 from the following code by entering summary(fm)$r.squared. Is there a way to get the p-value? If not, is there a function where I can enter the f-value and degrees of freedom to get the p-value? Thanks. x <- c(1,2,3,4,5,6,7,8,9,10) y <- c(1,2,3,4,4,5,6,8,1,9) fm
2011 Sep 28
2
apply lm function to dataset split by two variables
Dear all, I am not fluent in R and am struggling to 1) apply a lm to a weight-size dataset, thus the model has to run separately for each species, each year; 2) extract coefs, r-squared, n, etc. The data look like this: year sps cm w 2009 50 16 22 2009 50 17 42 2009 50 18 45 2009 51 15 45 2009 51 16 53 2009 51 17 73 2010 50 15 22 2010 50 16 41 2010 50 16 21 2010
2011 Aug 21
2
how to improve summary.lm
Hello, I need a shorter summary.lm, instead of -------------------------------------------- Call: lm(formula = E$t ~ E$cfs) Residuals: Min 1Q Median 3Q Max -0.239674 -0.007694 0.006430 0.014330 2.496551 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.994e-02 1.419e-04 -140.5 <2e-16 *** E$cfs 1.675e-05
2007 Apr 01
1
Keep R packages in the R installation
Hi, I just got a quick question here, when I install a new version of R , is there an easy to keep the installed R packages ? Thanks a lot for any help. tong
2013 Feb 19
1
Small quirks in summary.(g)lm docs
Hi! In R 3.0.0 from current SVN, ?summary.lm says: > Value [...] > df degrees of freedom, a 3-vector (p, n-p, p*), the last > being the number of non-aliased coefficients. ?summary.glm says: > df a 3-vector of the rank of the model and the number of residual > degrees of freedom, plus number of non-aliased coefficients. It seems to me that the description is reversed: p is
2011 Aug 15
2
Extracting information from lm results (multiple model runs)
Just to inform: I posted that before in R-sig-ecology but as it might be interesting also for other useRs, I post it also to the general r-user list: Hello Alexandre, thank you very much. I also found another way to extract summarizing information from lm results over e.g. 1000 repeated model runs: results2 <- t(as.data.frame(results)) summary(results2) Although some questions popped up in