Displaying 20 results from an estimated 6000 matches similar to: "glm or transformation of the response?"
2010 Sep 29
1
Understanding linear contrasts in Anova using R
#I am trying to understand how R fits models for contrasts in a
#simple one-way anova. This is an example, I am not stupid enough to want
#to simultaneously apply all of these contrasts to real data. With a few
#exceptions, the tests that I would compute by hand (or by other software)
#will give the same t or F statistics. It is the contrast estimates that
R produces
#that I can't seem to
2005 Mar 01
3
packages masking other objects
hello all,
I am trying to use the function getCovariateFormula(nlme) in conjunction with the library lme4. When I load both packages I get the following message and the getCovariateFormula function no longer works:
library(nlme)
library(lme4)
Attaching package 'lme4':
The following object(s) are masked from package:nlme :
contr.SAS getCovariateFormula
2009 Mar 09
1
lme anova() and model simplification
I am running an lme model with the main effects of four fixed variables (3
continuous and one categorical – see below) and one random variable. The
data describe the densities of a mite species – awsm – in relation to four
variables: adh31 (temperature related), apsm (another plant feeding mite)
awpm (a predatory mite), and orien (sampling location within plant – north
or south).
I have read
2010 Oct 03
5
How to iterate through different arguments?
If I have a model line = lm(y~x1) and I want to use a for loop to change the
number of explanatory variables, how would I do this?
So for example I want to store the model objects in a list.
model1 = lm(y~x1)
model2 = lm(y~x1+x2)
model3 = lm(y~x1+x2+x3)
model4 = lm(y~x1+x2+x3+x4)
model5 = lm(y~x1+x2+x3+x4+x5)...
model10.
model_function = function(x){
for(i in 1:x) {
}
If x =1, then the list
2009 Aug 20
1
nested, repeated measure lme
Dear all,
Suppose I have a nested, repeated measure lme model. Which of the following formulae is correct?
(assuming data are sampled from several plots in an agricultural experiment)
(1) y~explanatory.variables,random=~time|block/plot/subplot/individual
(2) y~explanatory.variables,random=~time|unique.ID.of.every.individual
I have read that (2) is the only approach that works. But how could I
2006 Sep 12
4
variables in object names
Is there any way to put an argument into an object name. For example,
say I have 5 objects, model1, model2, model3, model4 and model5.
I would like to make a vector of the r.squares from each model by code
such as this:
rsq <- summary(model1)$r.squared
for(i in 2:5){
rsq <- c(rsq, summary(model%i%)$r.squared)
}
So I assign the first value to rsq then cycle through models 2 through
2008 Jul 24
2
What is wrong with this contrast matrix?
Dear all,
I am fitting a multivariate linear model with 7 response variables and 1 explanatory variable.
The following matrix P:
P <- cbind(
c(1,-1,0,0,0,0,0),
c(2,2,2,2,2,-5,-5),
c(1,0,0,-1,0,0,0),
c(-2,-2,0,-2,2,2,2),
c(-2,1,0,1,0,0,0),
c(0,-1,0,1,0,0,0))
should consist of orthogonal elements (as can be shown using %*% on the individual columns).
However, when I use
2005 Jul 15
1
nlme and spatially correlated errors
Dear R users,
I am using lme and nlme to account for spatially correlated errors as
random effects. My basic question is about being able to correct F, p, R2
and parameters of models that do not take into account the nature of such
errors using gls, glm or nlm and replace them for new F, p, R2 and
parameters using lme and nlme as random effects.
I am studying distribution patterns of 50 tree
2008 Oct 02
1
An AIC model selection question
Dear R users,
Assume I have three models with the following AIC values:
model AIC df
model1 -10 2
model2 -12 5
model3 -11 2
Obviously, model2 would be preferred, but it "wastes" 5 df compared to the other models.
Would it be allowed to select model3 instead, simply because it uses up less df and the delta-AIC
between model2 and model3 is just 1?
Many thanks for any
2007 Nov 08
6
Extract correlations from a matrix
Dear R users,
suppose I have a matrix of observations for which I calculate all
pair-wise correlations:
m=matrix(sample(1:100,replace=T),10,10)
w=cor(m,use="pairwise.complete.obs")
How do I extract only those correlations that are >0.6?
w[w>0.6] #obviously doesn?t work,
and I can?t find a way around it.
I would very much appreciate any help!
Best wishes
Christoph
(using R
2008 Nov 06
2
replacing characters in formulae / models
Dear all,
How can I replace text in objects that are of class "formula"?
y="a * x + b"
class(y)="formula"
grep("x",y)
y[1]
Suppose I would like to replace the "x" by "w" in the formula object "y".
How can this be done? Somehow, the methods that can be used in character objects do not work 1:1 in
formula objects...
Many
2008 Feb 22
3
Simultaneously summarizing many models
Dear R users,
Let?s say I have 10 models, each named m1,m2,m3..., and I would like to summarize them automatically
and simultaneously - e.g., to extract parameter estimates later on from all models; how can I do that?
I have tried:
x=1:10 #this creates some example data
y=rnorm(10)
m1=lm(x~y)
m2=lm(x~1)
sum.lms=function(x)summary(paste("m",x,sep=""))
sum.lms(1:2)
but
2008 Jun 04
1
Comparing two regression lines
Dear R users,
Suppose I have two different response variables y1, y2 that I regress separately on the same
explanatory variable, x; sample sizes are n1=n2.
Is it legitimate to compare the regression slopes (equal variances assumed) by using
lm(y~x*FACTOR),
where FACTOR gets "y1" if y1 is the response, and "y2" if y2 is the response?
The problem I see here is that the
2010 Mar 28
1
keeping track of who did what
hello everybody.
i need to log "who did what" on some models. i was reading recipe 59
of rails recipes and i created something like that:
class LogSweeper < ActionController::Caching::Sweeper
observe :model1, :model2, :model3, :model4, :model5, ...
after_save(model)
save_log(model, "save")
end
after_destroy(model)
save_log(model, "destroy)
end
2011 Sep 28
2
GAMs in R : How to put the new data into the model?
I have 5 GAMs ( model1, model2, model3, model4 and model5)
Before I use some data X(predictor -January to June data) to form a equation
and calculate the expected value of Y (predictand -January to June). After
variable selection, GAMs (Model 1)were bulit up! R-square :0.40
NOW, I want to use new X'( predictor -July - December data) and put into
Model 1, then get the expected value of Y'
2009 Feb 09
1
gee with auto-regressive correlation structure (AR-M)
Dear all,
I need to fit a gee model with an auto-regressive correlation structure and I faced some problems.
I attach a simple example:
#######################################################
library(gee)
library(geepack)
# I SIMULATE DATA FROM POISSON DISTRIBUTION, 10 OBS FOR EACH OF 50 GROUPS
set.seed(1)
y <- rpois(500,50)
x <- rnorm(500)
id <- rep(1:50,each=10)
# EXAMPLES FOR
2007 May 07
4
Mardia's multivariate normality test
Dear all,
I got this error message
> library(dprep)
> mardia(Savg)
Error in cov(data) : 'x' is empty
But with the same data, I got
> library(mvnormtest)
> mshapiro.test(Savg)
Shapiro-Wilk normality test
data: Z
W = 0.9411, p-value = 0.6739
What does the error message "Error in cov(data) : 'x' is empty" mean? Thanks a lot!
Jiao
2007 Oct 17
1
problem with anova() and syntax in lmer
Dear R user
I have 2 problems with lmer.
The statistical consultance service of my university has recomended to me to
expose those problems here.
Sorry for this quite long message.
Your help will be greatly appreciated...
Gilles San Martin
1) anova()
I fit a first model :
model1 <- lmer(eclw~1 + density + landsc + temp + landsc:temp + (1|region) +
(1|region:pop) + (1|region:pop:family),
2006 Apr 16
0
[S] Problems with lme and 2 levels of nesting:Summary
I have taken the liberty of including the R-help mailing list on this
reply as that is the appropriate place to discuss lmer results.
On 4/5/06, Andreas Svensson <andreas.svensson at bio.ntnu.no> wrote:
> Hello again
> I have now recieved some helpful hints in this matter and will summarize them but first let me reiterate the problem:
>
> I had two treatments: 2 types of food
2008 Jun 07
1
Multivariate LM: calculating F-values after calling linear.hypothesis
Dear R users,
I am analyzing several response variables (all scaled to [0;1]) using a
multivariate linear model.
After fitting the model, I set up a hypothesis matrix to test specific
contrasts for these response variables; for example: "a always increases
significantly more than b when regressed against x".
What I am stuck with now is how to calculate the correct F-values (and