Displaying 20 results from an estimated 4000 matches similar to: "Weighted median"
2006 Apr 06
4
weighted kernel density estimate
Dear R-users,
I intend to do a spatial analysis on the genetic structuring within a
population. For this I had thought to prepare a kernel density estimate
map showing the spatial distribution of individuals, while incorporating
the genetic distances among individuals. I have a dataset of locations
of N unique individuals (XY-coordinates) and an NxN matrix with the
genetic distances given as a
2005 Aug 03
2
using weighted.mean with tapply()
I am trying to calculate the weighted mean for a of 10 deciles and I
get an error:
> decile <- tapply(X=mat$trt1m, INDEX=mat$Rank, FUN=weighted.mean, w=mat$mcap)
Error in FUN(X[[1]], ...) : 'x' and 'w' must have the same length
All three of my inputs have the same length, as shown below, and the
weighted.mean calculation works by itself, just not in tapply()
>
2000 Oct 23
4
More mdct questions
Sorry for starting another topic, this is actually a reply to Segher's post
on Sun Oct 22 on the 'mdct question' topic. I wasn't subscribed properly
and so I didn't get email confirmation and thus can't add to that thread.
So Segher, if the equation is indeed what you say it is, then replacing
mdct_backward with this version should work, but it doesn't.
Am I applying
2011 Aug 01
3
formula used by R to compute the t-values in a linear regression
Hello,
I was wondering if someone knows the formula used by the function lm to compute the t-values.
I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using is:
For the k-th variable, t-value= b_k/sigma_k
With b_k is the coefficient for the k-th variable, and sigma_k =(t(x) x )^(-1) _kk is its standard deviation.
2003 Nov 25
3
weighted mean
How do I go about generating a WEIGHTED mean (and standard error) of a
variable (e.g., expenditures) for each level of a categorical variable
(e.g., geographic region)? I'm looking for something comparable to PROC
MEANS in SAS with both a class and weight statement.
Thanks.
Marc
[[alternative HTML version deleted]]
2000 Sep 17
1
Weighted Histogram
Greetings,
I'm having trouble finding a simple way to calculate a weighted
histogram where there may be zero raw counts in a given interval.
Given equal-length vectors of data 'data' and weights 'w', and breaks
(intervals) for the histogram, I calculate a weighted histogram as
follows (see MASS's 'truehist' for an unweighted histogram):
bin <- cut(data,
2009 Jan 29
2
ANOVA in R
Hi
I Have a very large dataset that I would like to conduct ANOVA tests on. Im not a very strong programmer so any help would be appreciated.
the format is
Identifier A1 A2 B1 B2 C1 C2 Norm1 Norm2
1234 1 1 NA NA 4 3 NA NA
4567 2 2 4
2000 Oct 20
2
mdct question
Hi,
Can someone tell me which MDCT and invMDCT equation uses? I implemented the
invMDCT one given in
eusipco.corrected.ps file (handed out by Monty way back) and it produces
different time domain samples.
I tried both the FFT method and the slow way directly from the equation and
couldn't reproduce the results
from the original code. This leads me to believe that the forward
MDCT used in
2002 May 20
1
suggestion for example for base:naresid
Dear list:
since it took me a little while to figure out how to make use of naresid, I thought that
the below R code might be useful as an example on the help page.
Regards,
Markus
# generate some data
x1 <- runif(20)
y <- 10 + 5*x1 + rnorm(20)
summary(lm.0 <- lm(y ~ x1))
# append some NA's to y
y <- c(y, rep(NA, 5))
# generate some further x1s
x1 <- c(x1, runif(5))
#
2001 Aug 29
1
suggestion for example for base:naresid
Dear list:
since it took me a little while to figure out how to make use of naresid, I thought that
the below R code might be useful as an example on the help page.
Regards,
Markus
# generate some data
x1 <- runif(20)
y <- 10 + 5*x1 + rnorm(20)
summary(lm.0 <- lm(y ~ x1))
# append some NA's to y
y <- c(y, rep(NA, 5))
# generate some further x1s
x1 <- c(x1, runif(5))
#
2002 Jul 17
1
editing Sweave files in xemacs with ess (noweb), auctex and reftex
I am having some trouble getting reftex, in particular the bibtex
related features, to work properly in xemacs when editing text in Sweave
files. I have added
(defun Rnw-mode ()
(noweb-mode)
(if (fboundp 'R-mode)
(setq noweb-default-code-mode 'R-mode)))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist
2003 Nov 15
2
Using the rsync checksums for handling large logfiles.
Dear all,
I've only just joined this list, but I can't find any mention of this
idea anywhere else, so I thought I'd just post here before getting too
deep into programming and possibly reinventing the wheel.
Here at Aber, we have around 30 unix and linux servers doing core services.
Each one is maintaining its own logfiles and, for various reasons, we want to
keep these on the
2005 Feb 15
3
using poly in a linear regression in the presence of NA f ails (despite subsetting them out)
This smells like a bug to me. The error is triggered by the line:
variables <- eval(predvars, data, env)
inside model.frame.default(). At that point, na.action has not been
applied, so poly() ended being called on data that still contains missing
values. The qr() that issued the error is for generating the orthogonal
basis when evaluating poly(), not for fitting the linear model itself.
2005 Feb 15
3
using poly in a linear regression in the presence of NA f ails (despite subsetting them out)
This smells like a bug to me. The error is triggered by the line:
variables <- eval(predvars, data, env)
inside model.frame.default(). At that point, na.action has not been
applied, so poly() ended being called on data that still contains missing
values. The qr() that issued the error is for generating the orthogonal
basis when evaluating poly(), not for fitting the linear model itself.
2002 Jun 20
1
cut with infinite values -> NA
I am doing work on changes in establishment sizes and came across
behavior that is quite understandable and easily worked around but
a little surprising. On R 1.5.1 on Debian unstable (see below for
R.version output):
> cut.off <- c(-Inf, 0, Inf)
> x <- c(-Inf, -10, 0, 10, Inf)
> is.numeric(x)
[1] TRUE
> is.double(x)
[1] TRUE
> # but
> cut(x, cut.off, include.lowest=T)
[1]
2006 Aug 24
1
lmer(): specifying i.i.d random slopes for multiple covariates
Dear readers,
Is it possible to specify a model
y=X %*% beta + Z %*% b ; b=(b_1,..,b_k) and b_i~N(0,v^2) for i=1,..,k
that is, a model where the random slopes for different covariates are i.i.d., in lmer() and how?
In lme() one needs a constant grouping factor (e.g.: all=rep(1,n)) and would then specify:
lme(fixed= y~X, random= list(all=pdIdent(~Z-1)) ) ,
that?s how it's done in the
2007 Sep 12
1
Verifying understanding of backup-dir vs compare-dest
Hello,
Say one starts with creating an archive
rsync work -> archive
and periodically (below, i = 1 to N) does
rsync --backup-dir=a_<i> work -> archive
and rsync --compare-dest=archive work -> b_<i>
Then suppose one wants to recover the work directory as it was at
time k.
Using the b_<i> directories, one would merely merge
1999 Sep 01
1
Using R-0.65.0 under ESS on Unix
There is a bug in the command-line handling of 0.65.0 under Unix that
may affect some users of R-inferior-mode under ESS, as that sets
--no-readline as the first argument, and any arguments after that are
ignored.
The fix is simple: delete line 448 of src/unix/sys-common.c (`break;')
and re-compile.
The most used arguments are (I'm told) --vsize and --nsize. I find it more
convenient to
1999 Apr 07
1
R-0.64.0 oops
> For those who *are* desperate, I've left a copy in
> ftp://blueberry.kubism.ku.dk/pub/R-devel/R-0.64.0.tgz
> (Be gentle, that's my desktop PC!)
Well, *now* it's there anyway...
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
1999 Apr 07
1
R-0.64.0 oops
> For those who *are* desperate, I've left a copy in
> ftp://blueberry.kubism.ku.dk/pub/R-devel/R-0.64.0.tgz
> (Be gentle, that's my desktop PC!)
Well, *now* it's there anyway...
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918