Displaying 20 results from an estimated 4000 matches similar to: "Trouble with parametric bootstrap"
2009 Apr 03
1
Trouble extracting graphic results from a bootstrap
Hi,
I'm trying to extract a histogram over the results from a bootstrap. However
I keep receiving the error message "Error in hist.default(boot.lrtest$ll,
breaks = "scott") : 'x' must be numeric".
The bootstrap I'm running looks like:
> boot.test <- function(data, indeces, maxit=20) {
+ y1 <- fit1+e1[indeces]
+ mod1 <- glm(y1 ~ X1-1, maxit=maxit)
+
2010 Jan 28
2
Data.frame manipulation
Hi All,
I'm conducting a meta-analysis and have taken a data.frame with multiple
rows per
study (for each effect size) and performed a weighted average of effect size
for
each study. This results in a reduced # of rows. I am particularly
interested in
simply reducing the additional variables in the data.frame to the first row
of the
corresponding id variable. For example:
2018 Feb 14
0
Unexpected behaviour in rms::lrtest
Hello.
One of my teaching assistants was experimenting and encountered
unexpected behaviour with the lrtest function in the rms package. It
appears that when you have a pair of non-nested models that employ an
RCS, the error checking for non-nested models appears not to work.
Here is a reproducible example.
> library(rms)
Loading required package: Hmisc
Loading required package: lattice
2004 May 28
0
Merging nlme output
Dear list:
I am trying to merge two files together from output I get based on the coef() command. Here is what I am running into.
I have two simple linear mixed models
> mod1.lme<-lme(math~year, data=sample, random=~year|childid/schoolid)
> mod2.lme<-lme(math~year, data=sample, random=~year|childid)
I then call the coefficients and store them in the following objects using
>
2010 Jul 09
1
output without quotes
Hi All,
I am interested in printing column names without quotes and am struggling to
do it properly. The tough part is that I am interested in using these column
names for a function within a function (e.g., lm() within a wrapper
function). Therefore, cat() doesnt seem appropriate and print() is not what
I need. Ideas?
# sample data
mod1 <- rnorm(20, 10, 2)
mod2 <- rnorm(20, 5, 1)
dat
2010 Feb 15
2
creating functions question
Hi All,
I am interested in creating a function that will take x number of lm
objects and automate the comparison of each model (using anova). Here
is a simple example (the actual function will involve more than what
Im presenting but is irrelevant for the example):
# sample data:
id<-rep(1:20)
n<-c(10,20,13,22,28,12,12,36,19,12,36,75,33,121,37,14,40,16,14,20)
2008 Oct 16
1
lmer for two models followed by anova to compare the two models
Dear Colleagues,
I run this model:
mod1 <- lmer(x~category+subcomp+category*subcomp+(1|id),data=impchiefsrm)
obtain this summary result:
Linear mixed-effects model fit by REML
Formula: x ~ category + subcomp + category * subcomp + (1 | id)
Data: impchiefsrm
AIC BIC logLik MLdeviance REMLdeviance
4102 4670 -1954 3665 3908
Random effects:
Groups Name Variance
2013 Nov 25
0
R: lmer specification for random effects: contradictory reults
Dear Thierry,
thank you for the quick reply.
I have only one question about the approach you proposed.
As you suggested, imagine that the model we end up after the model selection
procedure is:
mod2.1 <- lmer(dT_purs ~ T + Z + (1 +T+Z| subject), data =x, REML= FALSE)
According to the common procedures specified in many manuals and recent
papers, if I want to compute the p_values relative to
2011 Oct 26
2
Error in summary.mlm: formula not subsettable
When I fit a multivariate linear model, and the formula is defined
outside the call to lm(), the method summary.mlm() fails.
This works well:
> y <- matrix(rnorm(20),nrow=10)
> x <- matrix(rnorm(10))
> mod1 <- lm(y~x)
> summary(mod1)
...
But this does not:
> f <- y~x
> mod2 <- lm(f)
> summary(mod2)
Error en object$call$formula[[2L]] <- object$terms[[2L]]
2006 Jul 21
0
[Fwd: Re: Parameterization puzzle]
Bother! This cold has made me accident-prone. I meant to hit Reply-all.
Clarification below.
-------- Original Message --------
Subject: Re: [R] Parameterization puzzle
Date: Fri, 21 Jul 2006 19:10:03 +1200
From: Murray Jorgensen <maj at waikato.ac.nz>
To: Prof Brian Ripley <ripley at stats.ox.ac.uk>
References: <44C063E5.3020703 at waikato.ac.nz>
2003 Feb 10
2
problems using lqs()
Dear List-members,
I found a strange behaviour in the lqs function.
Suppose I have the following data:
y <- c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8,
13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5,
12.0, 13.0, 14.1, 15.1)
x1 <- c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4,
10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0,
2012 Jun 06
3
Sobel's test for mediation and lme4/nlme
Hello,
Any advice or pointers for implementing Sobel's test for mediation in
2-level model setting? For fitting the hierarchical models, I am using
"lme4" but could also revert to "nlme" since it is a relatively simple
varying intercept model and they yield identical estimates. I apologize for
this is an R question with an embedded statistical question.
I noticed that a
2009 Oct 21
1
How to find the interception point of two linear fitted model in R?
Dear All,
Let have 10 pair of observations, as shown below.
######################
x <- 1:10
y <- c(1,3,2,4,5,10,13,15,19,22)
plot(x,y)
######################
Two fitted? models, with ranges of [1,5] and [5,10],?can be easily fitted separately by lm function as shown below:
#######################
mod1 <- lm(y[1:5] ~ x[1:5])
mod2 <- lm(y[5:10] ~ x[5:10])
#######################
2013 Nov 25
4
lmer specification for random effects: contradictory reults
Hi All,
I was wondering if someone could help me to solve this issue with lmer.
In order to understand the best mixed effects model to fit my data, I
compared the following options according to the procedures specified in many
papers (i.e. Baayen
<http://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDsQFjAA
2006 Jul 21
1
Parameterization puzzle
Consider the following example (based on an example in Pat Altham's GLM
notes)
pyears <- scan()
18793 52407 10673 43248 5710 28612 2585 12663 1462 5317
deaths <- scan()
2 32 12 104 28 206 28 186 31 102
Smoke <- gl(2,1,10,labels=c("No","Yes"))
Age <- gl(5,2,10,labels=c("35-44","45-54","55-64","65-74","75-84"),
2011 Jul 22
1
how to fix coefficients in regression
Hello all,
I am using a glm() and would like to fix one of the regression coefficients
to be a particular value and see what happens to the fit of the model. E.g.:
mod1 <- glm(Y ~ X1 + X2,family='binomial')
mod2 <- glm(Y~[fixed to 1.3]X1 + X2,family='binomial')
The beta for X1 is freely estimated in mod1 but is constrained to be 1.3 in
mod2. Is there a way to do this?
2010 Feb 20
3
aggregating using 'with' function
Hi All,
I am interested in aggregating a data frame based on 2
categories--mean effect size (r) for each 'id's' 'mod1'. The
'with' function works well when aggregating on one category (e.g.,
based on 'id' below) but doesnt work if I try 2 categories. How can
this be accomplished?
# sample data
id<-c(1,1,1,rep(4:12))
n<-c(10,20,13,22,28,12,12,36,19,12,
2008 Dec 22
0
post hoc comparisons on interaction means following lme
Dear Colleagues,
I have scoured the help files and been unable to find an answer to my
question. Please forgive me if I have missed something obvious.
I have run the following two models, where "category" has 3 levels and
"comp" has 8 levels:
mod1 <- lmer(x~category+comp+(1|id),data=impchiefsrm)
mod2 <- lmer(x~category+comp+category*comp+(1|id),data=impchiefsrm)
2006 Aug 29
2
lattice and several groups
Dear R-list,
I would like to use the lattice library to show several groups on
the same graph. Here's my example :
## the data
f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3"))
f1 <- rep(f1,3)
f2 <-
2008 Oct 22
1
lme4 question
Dear R Colleagues,
I run the following two models:
mod1 <- lmer(y ~ category + subcomp + (1 | id))
mod2 <- lmer(y ~ category + subcomp + category*subcomp + (1 | id)
where:
category has 4 possible values
subcomp has 24 possible values
id has approx 120 values (id is nested within category, and in unequal
numbers--i.e., unbalanced)
Then to look for differences in the models I run: