Displaying 20 results from an estimated 20000 matches similar to: "Insert value from same column of another row (lag across observations)"
2005 Oct 27
1
Repost: Examples of "classwt", "strata", and "sampsize" i n randomForest?
"classwt" in the current version of the randomForest package doesn't work
too well. (It's what was in version 3.x of the original Fortran code by
Breiman and Cutler, not the one in the new Fortran code.) I'd advise
against using it.
"sampsize" and "strata" can be use in conjunction. If "strata" is not
specified, the class labels will be used.
2005 Oct 27
1
Repost: Examples of "classwt", "strata", and "sampsize" in randomForest?
Sorry for the repost, but I've really been looking, and can't find any
syntax direction on this issue...
Just browsing the documentation, and searching the list came up short... I
have some unbalanced data and was wondering if, in a "0" v "1"
classification forest, some combo of these options might yield better
predictions when the proportion of one class is low (less
2005 Aug 10
2
Creating new columns inside a loop
Ok, I know R isn't an optimal environment for looping (or so I've heard) but
I have a need to loop through columns of data and create new columns of data
based on calculations within rows...
I'm sure there's a help file, but I'm not sure what search terms to use to
find it! The problem is that these new columns need to have names that I can
later access... Like NewVar1,
2007 Mar 15
2
replacing all NA's in a dataframe with zeros...
I've seen how to replace the NA's in a single column with a data frame
*> mydata$ncigs[is.na(mydata$ncigs)]<-0
*But this is just one column... I have thousands of columns (!) that I need
to do this, and I can't figure out a way, outside of the dreaded loop, do
replace all NA's in an entire data frame (all vars) without naming each var
separately. Yikes.
I'm racking my
2005 Nov 07
1
R seems to "stall" after several hours on a long series o f analyses... where to start?
You can test if the problem is accumulation in memory registers, which is
certainly what this sounds like. Just do a loop over a reasonably small
number of iterations and store or print the time between each iteration. If
memory accumulation it will run optimally for the first few iterations,
after which the time will increase noticeably (essentially exponentially,
hence ultimately freezes up). If
2007 Mar 23
1
memory, speed, and assigning results into new v. existing variable
I have a very large data frame, and I'm doing a conversion of all columns
into factors. Takes a while (thanks to folks here though, for making
faster!), but am wondering about optimization from a memory perspective...
Internally, am I better off assigning into a new data frame, or doing one of
these:
dataframe<-someoperation(dataframe)
It would seem that re-assigning into the same data
2010 Nov 21
1
abline(h=whatever) not working in candleChart() (in quantmod)?
Hello, all--
I am having some fun playing with the graphing in quantmod-- very nice! I am
writing a function to calculate (and hopefully plot) support and resistance
lines, but the usual plot call of "abline(h=value)" does not seem to work.
Here's my code:
require(quantmod)
AAPL<-getYahooData("AAPL")
candleChart(AAPL,subset="last 3
2005 Nov 07
4
R seems to "stall" after several hours on a long series of analyses... where to start?
Not sure where to even start on this.... I'm hoping there's some debugging I
can do...
I have a loop that cycles through several different data sets (same
structure, different info), performing randomForest growth and
predictions... saving out the predictions for later study...
I get about 5 hours in (9%... of the planned iterations.. yikes!) and R just
freezes.
This happens in
2005 Nov 23
2
TryCatch() with read.csv("http://...")
Hi, folks!
I'm trying to pull in data using read.csv("my URL goes here"), and it really
works fantastically. Amazing to pull in live data right off the internet,
into RAM, and get busy...
however...
occasionally there is a server problem, or the data are not up yet, and
instead of pushing through a nice CSV file, the server sends a 404 "Not
Found" page...
Since the
2005 Sep 13
1
Anyone have any code for importing data from NAMCS?
The National Ambulatory and Medical Care Survey is a free data set from the
CDC that I'd like to analyze using the "Survey" package in R. Before I dive
in, though, it occurred to me that someone may already have gone to the
trouble of writing code that will bring in the data and assign the variable
names and value labels. This is a big file, so doing it from scratch will
take
2005 May 15
1
Not sure if this is "aggregate" or some other task.
I have data where where I've taken some measurements three times... twice in
rapid succession so I could check test-retest reliability of a piece of
equipment, and then a third measurement some time later.
Not I'd like to do an analysis where I have two scores... the first being
the mean of the first two taken the same day, and the second being the one
taken later.
I have a lot of
2007 Apr 29
1
randomForest gives different results for formula call v. x, y methods. Why?
Just out of curiosity, I took the default "iris" example in the RF
helpfile...
but seeing the admonition against using the formula interface for large data
sets, I wanted to play around a bit to see how the various options affected
the output. Found something interesting I couldn't find documentation for...
Just like the example...
> set.seed(12) # to be sure I have
2006 May 23
1
Survey proportions... Can I use population as denominator?
Just giving the survey package a spin...
I'm accustomed to stata, and it seems very similar in many respects. One
thing is throwing me, however.
I've gotten my data in, and specified the design. Looks like the weighting
is right (based on published population estimates from these data), but now
I'd like to check my "marginal means" for proportions against those that
have
2005 Oct 04
1
"Survey" package and NAMCS data... unsure of specification
Hello, all.
I wanted to use the "survey" package to analyze data from the National
Ambulatory Medical Care Survey, and am having some difficulty translating
the analysis keywords from one package (Stata) to the other (R). The data
were collected using a multistage probability sampling, and there are
variables included to identify the sampling units and weights. Documentation
from the
2012 Apr 03
1
Compare by row and insert previous row value (Or non Time Series Lag)
I have the following sample dataset (CSV input here:http://goo.gl/YR8LP.
CSV output here: http://goo.gl/EFCC8) which I want to transform as follows.
For each person in a household I want to create two new variables OrigTAZ
and DestTAZ. It should take the value in TripendTAZ and put that in
DestTAZ. For OrigTAZ it should put value of TripendTAZ from the previous
row. For the first trip of every
2005 Oct 25
0
Examples of "classwt", "strata", and "sampsize" in randomForest?
Just browsing the documentation, and searching the list came up short... I
have some unbalance data and was wondering if, in a "0" v "1" classification
forest, if these options might yield better predictions when the proportion
of one class is low (less than 10% in a sample of 2,000 observations).
Not sure how to specify these terms... from the docs, we have:
classwt: Priors
2007 May 08
0
How might I -remove- a tree from a random forest?
I see the function "getTree", which is very interesting. As I'm trying to
teach myself more and more about R, and dealing with lists, it occurred to
me that it might be fun to remove (as in delete) a single tree from a
forest...say to go from 500 to 499.
I know, I know... "why?"
Why, to play, of course!
I've been doing a lot of reading on various tuning parameters,
2004 May 21
1
Memory Leak in OS X versions? (PR#6903)
Full_Name: David L. Van Brunt
Version: 1.8-1.9 beta
OS: OS X 10.3
Submission from: (NULL) (68.74.58.109)
As posted on R-Help (after which another user replicated the problem):
---------------
This is the conclusion from a prior thread ([R] " cannot allocate vector of
length 1072693248") which ended with no other answer but that there must be
a problem in the OS X version of R, or in
2004 Apr 05
2
Can't seem to finish a randomForest.... Just goes and goes!
Alternatively, if you can arrive at a sensible ordering of the levels
you can declare them ordered factors and make the computation feasible
once again.
Bill Venables.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Torsten Hothorn
Sent: Monday, 5 April 2004 4:27 PM
To: David L. Van Brunt, Ph.D.
Cc: R-Help
Subject:
2009 Oct 31
1
na.omit leaves cases with NA's intact
Strange, this normally works, but in a recent run, I have a data set in an
xts format, that has a lot of NA's in a few of the variables in the leading
and trailing positions, due to some lagging calculations. Before running an
analysis, I use
newdata<-na.omit(orginaldata)
and normally a
dim(newdata)
shows the fewer rows. Now, for some reason I do this operation and see that
hundreds of