Displaying 20 results from an estimated 3000 matches similar to: "How to write and analyze data with 3 dimensions"
2011 Feb 16
1
speed up the code
Hi All,
The following is a snippet of my code. It works fine but it is very slow. Is it possible to speed it up by using different data structure or better solution? For 40000 runs, it takes 8 minutes now. Thanks a lot
fun_activation = function(s_k, s_hat, x_k, s_hat_len)
{
common = intersect(s_k, s_hat);
if(length(common) != 0)
{
index = match(common, s_k);
2012 Feb 17
2
(subscript) logical subscript too long in using apply
Dear ALL
I have this function in R:
func_LN <- function(data){
med_ge <- matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data),
ncol=ncol(data), byrow=TRUE)
T <- matrix(c(rep(NA,length(n)*ncol(data))), nrow = length(n),
ncol=ncol(data), byrow=TRUE)
Tdiff<- matrix(c(rep(NA,length(n)*ncol(data))), nrow = length(n),
ncol=ncol(data), byrow=TRUE)
T1<- c(rep(NA,ncol(data)))
2023 May 12
2
Newbie: Controlling legends in graphs
Hello, I'm trying to create a line graph with a legend, but have no
success controlling the legend. Since nothing I've tried seems to work,
I must be doing something systematically wrong. Can anyone point this
out to me?
Here's my data:
> weights
# A tibble: 1,246 ? 3
Date J K
<date> <dbl> <dbl>
1 2000-02-13 133 188
2
2012 May 23
1
numerical integration
Greetings,
Sorry, the last message was sent by mistake! Here it is again:
I encounter a strange problem computing some numerical integrals on [0,oo).
Define
$$
M_j(x)=exp(-jax)
$$
where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products
$$
A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx
$$
Analytically we have
$$
A_{ij}=1/(a(i+j)).
$$
In the code below we compute the matrix
2010 Mar 25
1
how to deal with vector[0]?
Hi,
I have a vector with 4 elements, e.g., tau_i=c(100,200,300,400), but
potentially tau_i[0]=0. In a "for" loop,
tau_i=c(100,200,300,400)
m=4
tau_i[0]=0 # <------- ?
P_i=1
for(i in 2:m)
{
P_i = P_i*(tau_i[i-1]-tau_i[i-2])
}
Error in P_i = P_i * (tau_i[k - 1] - tau_i[k - 2]):
replacement has length zero
Unfortunately, I can add this potential element into
2003 Oct 31
1
constrained nonlinear optimisation in R?
Hello. I have searched the archives but have not found anything. I
need to solve a constrained optimisation problem for a nonlinear
function (“maximum entropy formalism”). Specifically,
Optimise: -1*SUM(p_ilog(p_i)) for a vector p_i of probabilities,
conditional on a series of constraints of the form:
SUM(T_i*p_i)=k_i for given values of T_i and k_i (these are
constraints on
2010 Dec 15
4
Generacion de binomiales correlacionadas
Buenas tardes,
Estoy interesado en generar observaciones de una distribucion binomial
bivariada en la que hay _cierto_ grado de correlacion (denotemoslo rho).
Podria por favor alguien indicarme como hacerlo en R?
Este es el contexto. Supongamos que se tienen dos experimentos en los que la
variable respuesta _sigue_ una distribucion binomial, i.e., X_i
~Binomial(n_i, p_i), i=1,2 y que, por ahora,
2009 Oct 28
2
regression on large file
Dear R community,
I have a fairly large file with variables in rows. Every variable
(thousands) needs to be regressed on a reference variable. The file is too
big to load into R (or R gets too slow having done it) and I do now read in
line by line with "scan" (see below) and write the results to out. Although
improved, this is still very slow... Can someone please help me and suggest
2012 May 23
0
numerical integrals
Greetings,
I encounter a strange problem computing some numerical integrals on [0,oo).
Define
$$
M_j(x)=exp(-jax)
$$
where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products
$$
A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx
$$
Analytically we have
$$
A_{ij}=1/(a(i+j)).
$$
In the code below we compute the matrix $A_{i,j}$, $1\leq i,j\leq 5$, numerically
and check against the known
2007 Mar 05
3
Mixed effects multinomial regression and meta-analysis
R Experts:
I am conducting a meta-analysis where the effect measures to be pooled
are simple proportions. For example, consider this data from
Fleiss/Levin/Paik's Statistical methods for rates and proportions (2003,
p189) on smokers:
Study N Event P(Event)
1 86 83 0.965
2 93 90 0.968
3 136 129 0.949
4 82 70 0.854
Total
2005 Jul 07
1
CDF plot
Dear all,
I have define a discrete distribution P(y_i=x_i)=p_i, which I want to
plot a CDF plot. However, I can not find a function in R to draw it
for me after searching R and R-archive. I only find the one for the
sample CDF instead my theoretical one.
I find stepfun can do it for me, however, I want to plot some
different CDF with same support x in one plot. I can not manage how to
do it with
2007 Mar 09
1
help with zicounts
Dear UseRs:
I have simulated data from a zero-inflated Poisson model, and would like
to use a package like zicounts to test my code of fitting the model.
My question is: can I use zicounts directly with the following simulated
data?
Create a sample of n=1000 observations from a ZIP model with no intercept
and a single covariate x_{i} which is N(0,1). The logit part is
logit(p_{i})=x_{i}*beta
2001 Feb 15
2
deviance vs entropy
Hello,
The question looks like simple. It's probably even stupid. But I spent several hours
searching Internet, downloaded tons of papers, where deviance is mentioned and...
And haven't found an answer.
Well, it is clear for me the using of entropy when I split some node of a classification tree.
The sense is clear, because entropy is an old good measure of how uniform is distribution.
2023 May 16
0
Newbie: Controlling legends in graphs
Rui, thanks so much for your help. Your explanation and example were
clear and concise. Thanks for taking the time and effort to help me.
-Kevin
On 5/12/23 16:06, Rui Barradas wrote:
> ?s 14:24 de 12/05/2023, Kevin Zembower via R-help escreveu:
>> Hello, I'm trying to create a line graph with a legend, but have no
>> success controlling the legend. Since nothing I've
2006 Dec 28
0
lmer: Interpreting random effects contrasts and model formulation
I'm trying to fit a nested mixed model using lmer and have some
questions about the output and my model formulations.
I have replicate measures on Lines which are strictly nested within
Populations.
(a) So if I want to fit a model where Line is a random effect and
Populations are fixed and the random Line effect is constant across
Populations, I have:
measure_ijk = mu + P_i + L_ij +
2009 Apr 08
0
Comparing Proportions Among Groups
Hi everyone,
I am trying to compare proportions among groups using the logistic
regression
approach as follows:
1) Fit the model log(p_i/(1-p_i)) = M + G_i, where p_i is the probability
of success in group i and G_i is the effect of group i, i=1,..,I.
2) Test the hypotheses:
Ho: G_1 = G_2 = ... = G_I (the probability of success is the same for all
groups)
versus
Ha: at least two
2023 May 16
0
[External Email] Newbie: Controlling legends in graphs
See below.
On 5/16/23 10:52, Christopher Ryan wrote:
> I"m more of a lattice guy than a ggplot guy, but perhaps this is part of
> the problem:
>
> .....
> ? ? ?geom_point(aes(y = m_K, color = "red")) +? ##### >> you've
> associated "K" with the color red
> ? ? ?geom_smooth(aes(y = m_K, color = "red")) +
>
2004 Feb 03
1
Stereo mode settings
Hi everyone,
I'd like a bit of information about the stereo mode settings in
psych_44.h of libvorbis. Specifically, about the adj_stereo structure:
typedef struct {
int pre[PACKETBLOBS];
int post[PACKETBLOBS];
float kHz[PACKETBLOBS];
float lowpasskHz[PACKETBLOBS];
} adj_stereo;
What I am attempting to do is bring lossless stereo coupling down to the
lower quality levels in
2009 Nov 04
1
compute maximum likelihood estimator for a multinomial function
Hi there
I am trying to learn how to compute mle in R for a multinomial negative
log likelihood function.
I am using for this the book by B. Bolker "Ecological models and data in
R", chapter 6: "Likelihood an all that". But he has no example for
multinomial functions.
What I did is the following:
I first defined a function for the negative log likelihood:
2004 Dec 03
3
Computing the minimal polynomial or, at least, its degree
Hi,
I would like to know whether there exist algorithms to compute the
coefficients or, at least, the degree of the minimal polynomial of a square
matrix A (over the field of complex numbers)? I don't know whether this
would require symbolic computation. If not, has any of the algorithms been
implemented in R?
Thanks very much,
Ravi.
P.S. Just for the sake of completeness, a