Displaying 20 results from an estimated 200 matches similar to: "strategy to iterate over repeated measures/longitudinal data"
2017 Aug 15
1
ANOVA test to decide whether to use multiple linear regression or linear mixed effects model
R-help:
I am trying to decide between using a multiple linear regression or a linear mixed effects model for my data:
model1 <- lm (responsevariable ~ predictor1 + predictor2 + predictor3 + predictor4, data= data)
model2 <- lme (responsevariable ~ predictor1 + predictor2 + predictor3 + predictor4, random = ~1 | site, data= data)
anova (model1, model2)
but I keep getting the
2013 Jul 20
2
Different x-axis scales using c() in latticeExtra
Hi,
I would like to combine multiple xyplots into a single, multipanel
display. Using R 3.0.1 in Ubuntu, I have used c() from latticeExtra
to combine three plots, but the x-axis for two plots are on a log
scale and the other is on a normal scale. I also have included
equispace.log=FALSE to clean up the tick labels. However, when I try
all of these, the x-axis scale of the first panel is used
2007 Oct 26
2
how do i find the annual maximun within several years?
dear kind helper,
i would like to know how to find the annual maximun for a table that
basicly looks like this:
date time measurement1 measurement2 measurement3
mm/dd/yyyy hh:mm:ss m1 m2 m3
there are about 9000 measurements for each year, which makes it quite
large...
i already tried to subset all rows for a year, to find the maximum
within these choosen rows,
y <-
2010 May 10
0
Plotting residuals from a sem object
R experts -
I'm using John Fox's sem package to analyze a simple path model (two correlated predictor variables directly influencing a single criterion variable):
Predictor1 -> Criterion
Predictor2 -> Criterion
Predictor1 <-> Predictor2
I'm giving a presentation on this material next week, and I'd like to use component-residual plots (i.e., partial residual plots)
2009 Dec 14
0
GBM package: Extract coefficients
I am using the gbm package for generalized boosted regression models,
and would like to be able to extract the coefficients produced for
storage in a database.
I am already using R to automatically generate formulas that I can
export to a database and store. For example, I have been using Dr.
Harrell's lrm package to perform logistic regression, e.g.:
output <-
2010 Oct 20
1
problem with predict(mboost,...)
Hi,
I use a mboost model to predict my dependent variable on new data. I get the following warning message:
In bs(mf[[i]], knots = args$knots[[i]]$knots, degree = args$degree, :
some 'x' values beyond boundary knots may cause ill-conditioned bases
The new predicted values are partly negative although the variable in the training data ranges from 3 to 8 on a numeric scale. In order to
2011 Nov 18
0
Kalman Filter with dlm
I have built a Kalman Filter model for flu forecasting as shown below.
Y - Target Variable X1 - Predictor1 X2 - Predictor2
While forecasting into the future, I will NOT have data for all three
variables. So, I am predicting X1 and X2 using two Kalman filters. The code
is below
x1.model <- dlmModSeas(52) + dlmModPoly(1, dV=5, dW=10)
x2.model <- dlmModSeas(52) + dlmModPoly(1, dV=10,
2007 Apr 18
0
Specifying ANCOVA models in R
Hi all,
I am trying to fit an ANOVA model in R using the aov/lm commands. I have a
set of observational (i.e. no fixed experimental effects) data, in which I
have identified high and low clusters of the response variable. The design
is unbalanced, with 773 high cluster observations, and 523 low cluster
observations. I would like to test a set of 7 correlates to see if there are
significant
2005 Mar 10
2
Logistic regression goodness of fit tests
I was unsure of what suitable goodness-of-fit tests existed in R for logistic regression. After searching the R-help archive I found that using the Design models and resid, could be used to calculate this as follows:
d <- datadist(mydataframe)
options(datadist = 'd')
fit <- lrm(response ~ predictor1 + predictor2..., data=mydataframe, x =T, y=T)
resid(fit, 'gof').
I set up a
2009 Dec 10
2
different randomForest performance for same data
Hello,
I came across a problem when building a randomForest model. Maybe someone can help me.
I have a training- and a testdataset with a discrete response and ten predictors (numeric and factor variables). The two datasets are similar in terms of number of predictor, name of variables and datatype of variables (factor, numeric) except that only one predictor has got 20 levels in the training
2005 Apr 08
1
subset arg lmList
I'm having trouble understanding how functions in the subset argument for
lmList search for the objects they need. This trivial example produces
"Error in rownames(fakedf) : Object "fakedf" not found":
library(nlme)
fitbyID <- function() {
fakedf <- data.frame(ID = gl(5, 10, 50),
A = sample(1:100, 50),
B = rnorm(50))
2010 Sep 24
2
Data manipulation in R
If this has already been answered, my apologies in advance I am relatively
new to this aspect of [R]. it is a bit of a basic question.
I have 4 columns of data (site, Date, measurement type, value) in a tab
delimited text file. Site is a site where measurements were collected,
Date is a date in DD/MM/YYYY format, measurement is a code for the type of
measurement made, and value just the value
2009 Dec 16
2
rcart - classification and regression trees (CART)
Hi,
I am trying to use CART to find an ideal cut-off value for a simple
diagnostic test (ie when the test score is above x, diagnose the condition).
When I put in the model
fit=rpart(outcome ~ predictor1(TB144), method="class", data=data8)
sometimes it gives me a tree with multiple nodes for the same predictor (see
below for example of tree with 1 or multiple nodes). Is there a way
2010 Jun 18
0
pcse package - is it OK to use it when my regression is weighted by each subgroup's mean
Hello!
Just would like to make sure I am not doing something wrong.
I am running an OLS regression. I have several subgroups in the data
set (locations) - and in each location I have weekly data for 2 years
- on my DV and on all predictors. Looks like this:
location week DV Predictor1 Predictor 2
location1 week1 xxx xxxxxxx xxxxxxxxx
location1 week2 xxx xxxxxxx xxxxxxxxx
.
.
2006 May 19
1
UseMethod infelicity
If I do
> example(lm)
...
> mycoef <- function(object, ...) UseMethod("coef", object)
> mycoef(lm.D9)
Error in mycoef(lm.D9) : no applicable method for "coef"
which is pretty surprising, as coef has a default method.
After a bit of digging, this comes from do_usemethod having
defenv = environment where the generic was defined */
defenv =
2016 Apr 30
0
Unexpected scores from weighted PCA with svyprcomp()
Hello!
I'd like to create an assets-based economic indicator using data from a
national household survey. The economic indicator is to be the first
principal component from a principal components analysis, which (given
the source of the data) I believe should take in consideration the
sampling weights of the observations. After running the PCA with
svyprcomp(), from the survey package, I
2012 May 05
2
No error message no display output
Hi all,
I´m re-starting (as my name indicates) my little knowlegde of CRAN R.
I made this function time before but I don´t know where is the error
because nothing appears as an error but the histogram plot doesn´t appear.
Should I install some special library to run sapply?
pru<-function(){
randz<-matrix(rnorm(200000),100,2000)
H<-matrix(0,100,2000)
for (j in 2:2000){
for (i in
2012 May 10
1
Error t value matrix
Hi all,
I want to make the following:
I want to run a linear regression on each column of a matrix "estima" on
the correspondent column on the matrix "estima2".
You see I want to regress estima[,1] on estima2[,1] this way to all
columns....
At the same time I want to make a regression adding each time a new
observation.
You see, the first regression will regress only one
2011 Jul 07
3
coefficients lm of data.frame
Hi,
I've a data frame like this:
> as.data.frame(cbind(rnorm(1:12),rnorm(1:12)))
V1 V2
1 -1.30849402 -0.52094136
2 0.96157302 0.76217871
3 -0.44223351 -1.72630871
4 -0.10432438 -1.04732942
5 -1.38748914 0.95877311
6 -0.63965975 0.65494811
7 -0.24058318 0.19496830
8 -0.11172988 1.01680655
9 0.08065333 0.22168589
10 0.25196536 0.84619914
11
2009 Jun 29
2
How to use "subset" in lm function
Hi, I'm using R to do a time series analysis. In the model, I use the lags
of some variables. such the lags of the variables have different length, I
just can't use them directly in the lm function. Intuitively, I feel that
"subset" might be useful, but I do not know how to use it. Anyone can give
me an example syntax? Thanks.
Harry
[[alternative HTML version deleted]]