Displaying 20 results from an estimated 800 matches similar to: "Retrieving an evaluated gradient value (UNCLASSIFIED)"
2007 Dec 27
2
A function for random test based on longest run (UNCLASSIFIED)
Classification: UNCLASSIFIED
Caveats: NONE
Hello, R users,
Has anybody written a function for random test based on the length of
longest run of same events. I really appreciate your help.
Kyong Park
Classification: UNCLASSIFIED
Caveats: NONE
[[alternative HTML version deleted]]
2008 Mar 14
1
Lme does not work without a random effect (UNCLASSIFIED)
Classification: UNCLASSIFIED
Caveats: NONE
Dear R users,
I'm interested in finding a random effect of the Block in the data shown
below, but 'lme' does not work without the random effect. I'm not sure how
to group the data without continuous value which is shown in the error
message at the bottom line. If I use 'aov' with Error(Block), is there a
test method comparing
2007 Dec 27
1
A function for random test based on longest run (UNCLASSI FIED)
Classification: UNCLASSIFIED
Caveats: NONE
Thanks for your quick response. The program you mentioned below available
from R is based on number of runs (up or down) not based on a longest length
of runs of same events. To be more specific, for example, from a series,
HHTHTTTTHHH, the number of runs are 5, and the longest length of runs of the
same events is 4. I'll check for the website you
2008 Jun 16
1
aggregate() function, strange behavior for augmented data
All,
I'm re-running some analysis that has been augmented with additional data.
When I use the exact same code for the augmented data, the behavior of the
aggregate function is very strange, viz., one of the resulting variables is
now coded as a factor while it was coded as numeric for the original data.
Unfortunately, I cannot provide a reproducible code example since it only
seems to occur
2010 Aug 10
4
Function to Define a Function
I am trying to define a general R function that has a function as the output that depends on the user's input arguments (this may make more sense by looking at the toy example below). My real use for this type of code is to allow a user to choose from many parameterizations of the same general model.
My "issue" is that when I compile a package with this type of code in it I get a
2017 Jun 01
5
Reversing one dimension of an array, in a generalized case
Hi All:
I have been looking for an elegant way to do the following, but haven't found it, I have never had a good understanding of any of the "apply" functions.
A simplified idea is I have an array, say:
junk(5, 10, 3)
where (5, 10, 3) give the dimension sizes, and I want to reverse the second dimension, so I could do:
junk1 <- junk[, rev(seq_len(10), ]
but what I am
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
Thanks to all for responses/. There was a question of exactly what was wanted. It is the generalization of the obvious example I gave,
>>> junk1 <- junk[, rev(seq_len(10), ]
so that
junk[1,1,1 ] = junk1[1,10,1]
junk[1,2,1] = junk1[1,9,1]
etc.
The genesis of this is the program is downloading data from a variety of sources on (time, altitude, lat, lon) coordinates, but all
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
How about this:
f <- function(a,wh){ ## a is the array; wh is the index to be reversed
l<- lapply(dim(a),seq_len)
l[[wh]]<- rev(l[[wh]])
do.call(`[`,c(list(a),l))
}
## test
z <- array(1:120,dim=2:5)
## I omit the printouts
f(z,2)
f(z,3)
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into
2004 Jul 07
7
Importing an Excel file
Hello, R users,
I am a very beginner of R and tried read.csv to import an excel file after
saving an excel file as csv. But it added alternating rows of fictitious NA
values after row number 16. When I applied read.delim, there were trailing
several commas at the end of each row after row number 16 instead of NA
values. Appreciate your help.
Kyong
[[alternative HTML version deleted]]
2012 Dec 06
1
Get an expected value for Order Statistics by applying double integrals
Hi R users,
I’d like to get an expected value for a minimum value from order
statistics of sample size, say, 5 for standard normal distribution, and the
formula would be 5* Integral (from -inf to Inf) x*f(x)* (1-F(x))^4,where
f(x) and F(x) are a standard normal density and a cumulative distribution
function respectively. After searching R posts, I applied the following
double integral
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
On the off chance that anyone is still interested, here is the corrected function using aperm():
z <- array(1:120,dim=2:5)
f2 <- function(a, wh) {
idx <- seq_len(length(dim(a)))
dims <- setdiff(idx, wh)
idx <- append(idx[-1], idx[1], wh-1)
aperm(apply(a, dims, rev), idx)
}
all.equal(f(z, 1), f2(z, 1))
# [1] TRUE
all.equal(f(z, 2), f2(z, 2))
# [1] TRUE
2017 Jun 01
3
Reversing one dimension of an array, in a generalized case
> On 1 Jun 2017, at 22:42, Roy Mendelssohn - NOAA Federal <roy.mendelssohn at noaa.gov> wrote:
>
> Thanks to all for responses/. There was a question of exactly what was wanted. It is the generalization of the obvious example I gave,
>
>>>> junk1 <- junk[, rev(seq_len(10), ]
>
>
> so that
>
> junk[1,1,1 ] = junk1[1,10,1]
> junk[1,2,1] =
2017 Jun 01
1
Reversing one dimension of an array, in a generalized case
Thanks again. I am going to try the different versions. But I probably won't be able to get to it till next week.
This is probably at the point where anything further should be sent to me privately.
-Roy
> On Jun 1, 2017, at 1:56 PM, David L Carlson <dcarlson at tamu.edu> wrote:
>
> On the off chance that anyone is still interested, here is the corrected function using
2017 Jun 01
2
Reversing one dimension of an array, in a generalized case
My error. Clearly I did not do enough testing.
z <- array(1:24,dim=2:4)
> all.equal(f(z,1),f2(z,1))
[1] TRUE
> all.equal(f(z,2),f2(z,2))
[1] TRUE
> all.equal(f(z,3),f2(z,3))
[1] "Attributes: < Component ?dim?: Mean relative difference: 0.4444444 >"
[2] "Mean relative difference: 0.6109091"
# Your earlier example
> z <- array(1:120, dim=2:5)
>
2017 Jun 01
3
Reversing one dimension of an array, in a generalized case
Here is an alternative approach using apply(). Note that with apply() you are reversing rows or columns not indices of rows or columns so apply(junk, 2, rev) reverses the values in each column not the column indices. We actually need to use rev() on everything but the index we are interested in reversing:
f2 <- function(a, wh) {
dims <- seq_len(length(dim(a)))
dims <-
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
??
> z <- array(1:24,dim=2:4)
> all.equal(f(z,3),f2(z,3))
[1] "Attributes: < Component ?dim?: Mean relative difference: 0.4444444 >"
[2] "Mean relative difference: 0.6109091"
In fact,
> dim(f(z,3))
[1] 2 3 4
> dim(f2(z,3))
[1] 3 4 2
Have I made some sort of stupid error here? Or have I misunderstood
what was wanted?
Cheers,
Bert
Bert Gunter
2005 Jun 10
1
Abrupt shut down of R session
Dear R users,
I'm using R 2.1.0 with Windows 2000. In the middle of a R session, an error
message pops up saying Rgui.exe generated errors and shuts down the R
session. How can I correct this problem? Appreciate your help.
Kyong
[[alternative HTML version deleted]]
2010 Nov 22
2
Probit Analysis: Confidence Interval for the LD50 using Fieller's and Heterogeneity (UNCLASSIFIED)
Classification: UNCLASSIFIED
Caveats: NONE
A similar question has been posted in the past but never answered. My
question is this: for probit analysis, how do you program a 95%
confidence interval for the LD50 (or LC50, ec50, etc.), including a
heterogeneity factor as written about in "Probit Analysis" by
Finney(1971)? The heterogeneity factor comes into play through the
chi-squared
2008 Mar 17
0
Summary Regard with Lme does not work without a random effect (UN CLASSIFIED)
Classification: UNCLASSIFIED
Caveats: NONE
R users,
This is a summary for the responses I got from Sandra Dorai-Raj and Simon
Blomberg followed by my question.
Sandra suggested using lm instead of lme for a model without a random
effect, and Simon suggested anova.lme instead of anova.lm for comparing two
models with and without a random effect. For the anova test, both anova.lme
and anova
2011 Jan 01
3
Retrieving Factors with Levels Ordered
Hello (and Happy New Year),
When I create a factor with labels in the order I want, write the data as a text file, and then retrieve them, the factor levels are no longer in the proper order.
Here is what I do (I tried many variations):
# educ is a numeric vector with 1,001 observations.
# There is one NA
# Use educ to create a factor
feducord <- factor(educ, labels = c('Elem',