[R] removing intercept from lm() results in oddly high Rsquared

2006-08-06 Thread Joseph LeBouton
Can anyone help me understand why an lm model summary would return an r.squared of ~0.18 with an intercept term, and an r.squared of ~0.98 without the intercept? The fit is NOT that much better, according to plot.lm: residuals are similar between the two models, and a plot of observed x

[R] changing degrees of freedom in summary.lm()

2006-02-26 Thread Joseph LeBouton
Hello all, I'm trying to do a nested linear model with a dataset that incorporates an observation for each of several classes within each of several plots. I have 219 plots, and 17 classes within each plot. data.frame has columns plot,class,age,dep.var With lm(dep.var~class*age), The

[R] SUMMARY: aggregate vs. tapply

2006-02-12 Thread Joseph LeBouton
Hi all; Thanks for the responses to my query of how to make tapply into a table instead of an n-dimensional array. Summary of responses follows: Peter Dalgaard: as.data.frame(with(tmp,as.table(tapply(C,list(A=A,B=B),sum Phil Spector wrote: z = tapply(y,list(var1,var2,var3,var4),sum)

[R] aggregate vs tapply; is there a middle ground?

2006-02-11 Thread Joseph LeBouton
Dear all, I'm wanting to do a series of comparisons among 4 categorical variables: a - aggregate(y, list(var1, var2, var3, var4), sum) This gets me a very nice 2-dimensional data frame with one column per variable, BUT, as help for aggregate says, empty subsets are removed. I don't see in

Re: [R] aggregate vs tapply; is there a middle ground?

2006-02-11 Thread Joseph LeBouton
Department of Statistics UC Berkeley [EMAIL PROTECTED] On Sat, 11 Feb 2006, Joseph LeBouton wrote: Dear all, I'm wanting to do a series of comparisons among 4 categorical variables: a - aggregate(y, list(var1, var2, var3, var4), sum

Re: [R] Ordering boxplot factors; thank you!

2006-01-08 Thread Joseph LeBouton
to look. The sad truth is that I was heading for a ~10-line hacker solution. You've saved me from my usual code-writing ignomy. Happy new year, -Joseph Prof Brian Ripley wrote: On Thu, 5 Jan 2006, Marc Schwartz wrote: On Thu, 2006-01-05 at 20:27 -0600, Joseph LeBouton wrote: Hi all, what

[R] Ordering boxplot factors

2006-01-05 Thread Joseph LeBouton
Hi all, what a great help list! I hope someone can help me with this puzzle... I'm trying to find a simple way to do: boxplot(obs~factor) so that the factors are ordered left-to-right along the x-axis by median, not alphabetically by factor name. Complicated ways abound, but I'm hoping for a

[R] probability histogram question

2004-08-19 Thread Joseph LeBouton
Hello, all; I get an unexpected result when trying to plot a probability histogram with R1.9.1 on windows xp: #with the following code: x - runif(100,0,1) hist(x) hist(x, freq=F) h - hist(x, freq=F) summary(h) #Length Class Mode #breaks 11 -none- numeric #counts 10

Re: [R] probability histogram question

2004-08-19 Thread Joseph LeBouton
Joseph LeBouton [EMAIL PROTECTED] 08/20/04 09:56am Hello, all; I get an unexpected result when trying to plot a probability histogram with R1.9.1 on windows xp: #with the following code: x - runif(100,0,1) hist(x) hist(x, freq=F) h - hist(x, freq=F) summary(h) #Length Class Mode #breaks