similar to: using "substitute" inside a legend

Displaying 20 results from an estimated 4000 matches similar to: "using "substitute" inside a legend"

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
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
2011 Apr 14
1
mixed model random interaction term log likelihood ratio test
Hello, I am using the following model model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair), data=MateChoice, REML=F) 1. After reading around through the R help, I have learned that the above code is the right way to analyze a mixed model with the MatingPair as the fixed effect, DrugPair as the random effect and the interaction between these two as the random effect as well.
2012 Nov 08
2
Comparing nonlinear, non-nested models
Dear R users, Could somebody please help me to find a way of comparing nonlinear, non-nested models in R, where the number of parameters is not necessarily different? Here is a sample (growth rates, y, as a function of internal substrate concentration, x): x <- c(0.52, 1.21, 1.45, 1.64, 1.89, 2.14, 2.47, 3.20, 4.47, 5.31, 6.48) y <- c(0.00, 0.35, 0.41, 0.49, 0.58, 0.61, 0.71, 0.83, 0.98,
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
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
2008 Nov 25
4
glm or transformation of the response?
Dear all, For an introductory course on glm?s I would like to create an example to show the difference between glm and transformation of the response. For this, I tried to create a dataset where the variance increases with the mean (as is the case in many ecological datasets): poissondata=data.frame( response=rpois(40,1:40), explanatory=1:40) attach(poissondata) However, I have run into
2010 Feb 09
1
Missing interaction effect in binomial GLMM with lmer
Dear all, I was wondering if anyone could help solve a problem of a missing interaction effect!! I carried out a 2 x 2 factorial experiment to see if eggs from 2 different locations (Origin = 1 or 2) had different hatching success under 2 different incubation schedules (Treat = 1 or 2). Six eggs were taken from 10 females (random = Female) at each location and split between the treatments,
2009 Dec 10
1
updating arguments of formulae
Dear R-Community, I am relatively new with R, so sorry for things which for you might be obvious... I am trying to automatically update lmer formulae. the variables of the model are: depM= my dependent measure Sb2= a random factor OS = a predictor VR= another predictor So, I am building the first model with random intercept only: model = lmer(depM ~ (1 |Sb2)) then I update the formula
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 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
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
2012 Mar 14
1
lme code help
Hi guys, Got a few days left and I need to model a random effect of species on the body mass (logM) and temperature (K) slopes. This is what i've done so far that works: model1<-lme(logSSP~logM + K,random=~1|species,data=data1) model2<-lme(logSSP~logM + K,random=~K|species,data=data1) model3<-lme(logSSP~logM + K,random=~logM|species,data=data1) The one I now want is:
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),
2010 Apr 01
2
Adding regression lines to each factor on a plot when using ANCOVA
Dear R users, i'm using a custom function to fit ancova models to a dataset. The data are divided into 12 groups, with one dependent variable and one covariate. When plotting the data, i'd like to add separate regression lines for each group (so, 12 lines, each with their respective individual slopes). My 'model1' uses the group*covariate interaction term, and so the coefficients
2007 Jan 03
1
problem with logLik and offsets
Hi, I'm trying to compare models, one of which has all parameters fixed using offsets. The log-likelihoods seem reasonble in all cases except the model in which there are no free parameters (model3 in the toy example below). Any help would be appreciated. Cheers, Jarrod x<-rnorm(100) y<-rnorm(100, 1+x) model1<-lm(y~x) logLik(model1) sum(dnorm(y, predict(model1),
2011 Sep 08
1
predict.rma (metafor package)
Hi (R 2.13.1, OSX 10.6.8) I am trying to use predict.rma with continuous and categorical variables. The argument newmods in predict.rma seems to handle coviariates, but appears to falter on factors. While I realise that the coefficients for factors provide the answers, the goal is to eventually use predict.rma with ANCOVA type model with an interaction. Here is a self contained example
2004 Oct 26
3
GLM model vs. GAM model
I have a question about how to compare a GLM with a GAM model using anova function. A GLM is performed for example: model1 <-glm(formula = exitus ~ age+gender+diabetes, family = "binomial", na.action = na.exclude) A second nested model could be: model2 <-glm(formula = exitus ~ age+gender, family = "binomial", na.action = na.exclude) To compare these two GLM