Displaying 20 results from an estimated 6000 matches similar to: "Weighted Mean By Factor Using "BY""
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers,
I'd like to submit SQLDF statements with R objects as column names.
For example, I want to assign "X" to "var1" (var1<-"X") and then refer to
"var1" in the SQLDF statement. SQLDF needs to understand that when I
reference "var1", it should look for "X" in the dataframe.
This is necessary because my SQLDF
2011 Feb 25
0
e1071's Naive Bayes with Weighted Data
Hello fellow R programmers,
I'm trying to use package e1071's naiveBayes function to create a model with
weighted data. See example below, variable "d" is a count variable that
provides the # of records for the given observation combination. Is anyone
aware of a "weight" argument to this method? I've been unsuccessful in my
research.
Thanks,
Mike
2008 Jun 25
1
weighted inverse chi-square method for combining p-values
Hi,
This is more of a general question than a pure R one, but I hope that is OK.
I want to combine one-tailed independent p-values using the weighted version
of fisher's inverse chi-square method. The unweighted version is pretty
straightforward to implement. If x is a vector with p-values, then I guess
that this will do for the unweighted version:
statistic <- -2*sum(log(x))
comb.p <-
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,
2006 Mar 01
1
Drop1 and weights
Hi,
If I used drop1 in a weighted lm fit, it seems to ignore the weights
in the AIC calculation of the dropped terms, see the example below.
Can this be right?
Yan
--------------------
library(car)
> unweighted.model <- lm(trSex ~ (river+length +depth)^2-
length:depth, dno2)
> Anova(unweighted.model)
Anova Table (Type II tests)
Response: trSex
Sum Sq Df F value
2006 Mar 01
2
Weighted networks and multigraphs
I would like to apply network measures (such as betweenness centrality,
upper boundedness, etc.) to a weighted graph with non-integer weights,
defined by a euclidean distance matrix. The package sna provides the
measures that I want to use, but seems only to operate on binary graphs.
I have read work by Mark Newman
(http://aps.arxiv.org/abs/cond-mat/0407503/), who suggests that a
weighted graph
2011 Oct 21
1
lattice::xyplot/ggplot2: plotting weighted data frames with lmline and smooth
In the HistData package, I have a data frame, PearsonLee, containing
observations on heights of parent and child, in weighted form:
library(HistData)
> str(PearsonLee)
'data.frame': 746 obs. of 6 variables:
$ child : num 59.5 59.5 59.5 60.5 60.5 61.5 61.5 61.5 61.5 61.5 ...
$ parent : num 62.5 63.5 64.5 62.5 66.5 59.5 60.5 62.5 63.5 64.5 ...
$ frequency: num 0.5 0.5
2006 Aug 25
1
R.squared in Weighted Least Square using the Lm Function
Hello all,
I am using the function lm to do my weighted least
square regression.
model<-lm(Y~X1+X2, weight=w)
What I am confused is the r.squared.
It does not seem that the r.squared for the weighted
case is an ordinary 1-RSS/TSS.
What is that precisely?
Is the r.squared measure comparable to that obtained
by the ordinary least square?
<I also notice that
model$res is the unweighted
2011 Feb 08
1
Naive Bayes Issue - Can't Predict - Error is "Error in log(sapply(attribs...)
Hey guys,
I can't get my Naive Bayes model to predict. Forgive me if its simple...
I've tried about everything and can't get it to work. Reproduceable code
below.
Thank you,
Mike
--
Michael Schumacher
Manager Data & Analytics - ValueClick
mike.schumacher@gmail.com
*
Functional Example Code from UCLA:
2010 Jul 20
1
Servreg $loglik
Dear R-experts:
I am using survreg() to estimate the parameters of a Weibull density having
right-censored observations. Some observations are weighted. To do that I
regress the weighed observations against a column of ones.
When I enter the data as 37 weighted observations, the parameter estimates
are exactly the same as when I enter the data as the corresponding 70
unweighted observations.
2007 Aug 23
1
degrees of freedom question
R2.3, WinXP
Dear all,
I am using the following functions:
f1 = Phi1+(Phi2-Phi1)/(1+exp((log(Phi3)-log(x))/exp(log(Phi4)))
f2 = Phi1+(Phi2-Phi1)/(1+exp((log(Phi3)-log(r)-log(x))/exp(log(Phi4)))
subject to the residual weighting
Var(e[i]) = sigma^2 * abs( E(y) )^(2*Delta)
Here is my question, in steps:
1. Function f1 is separately fitted to two different datasets
corresponding to
2008 Apr 28
0
weighted nonlinear fits: `nls' and `eval'
dear list,
my question concerns the use of `eval' in defining the model formula
for `nls' (version 2.6.2.).
consider the following simple example, where the same model and data
are used to perform unweighted and weighted fits. I intentionally
used very uneven weights to guarantee large differences in the results
#================================CUT===========================
ln
2009 Oct 20
2
Weighted Logistic Regressions using svyglm
I?m running some logistic regressions and I?ve been trying to include weights
in the equation. However, when I run the model, I get this warning message:
Here?s what it says: Warning message: In eval(expr, envir, enclos) :
non-integer #successes in a binomial glm!
I think it is because the weights are non-integer values.
What is a good way to run logistic regressions in R when using
2007 Oct 19
2
In a SLR, Why Does the Hat Matrix Depend on the Weights?
I understand that the hat matrix is a function of the predictor variable
alone. So, in the following example why do the values on the diagonal of the
hat matrix change when I go from an unweighted fit to a weighted fit? Is the
function hatvalues giving me something other than what I think it is?
library(ISwR)
data(thuesen)
attach(thuesen)
fit <- lm(short.velocity ~ blood.glucose)
2008 Apr 30
0
weighted nonlinear fits: `nls' and `eval'
2 days ago I asked this on r-help, but no luck... since
this is actually a programming question, I post it here
again:
my question concerns the use of `eval' in defining the model
formula for `nls' when performing weighted fits. (I use
version 2.6.2., but according to NEWS there were no changes
to `nls' in 2.7.0, so the problem is still present). in this
scenario their
2007 Mar 22
3
Cohen's Kappa
Hi,
im little bit confused about Cohen's Kappa and i should be look into the
Kappa function code. Is the easy formula really wrong?
kappa=agreement-chance/(1-chance)
many thanks
christian
###############################################################################
true-negativ:7445
false-positive:3410
false-negativ:347
true-positiv:772
classification-aggrement:68,6%
2005 Jun 28
1
Possible bug in summary of residuals with lm and weights
I sent this to r-devel the other day but didn't get any takers. This
may not be a bug but rather an inconsistency.
I'm not sure if this is intentional. summary.lm stores weighted
residuals whereas I think most users will want print.summary.lm to
summarize unweighted ones as if saying summary(resid(fit)).
> set.seed(1)
> dat <- data.frame(y = rnorm(15), x = rnorm(15), w = 1:15)
2009 Jul 21
1
package quantreg behaviour in weights in function rq,
Dear all,
I am having v.4.36 of Quantreg package and I noticed strange behaviour when
weights were added. Could anyone please explain me what if the results are
really strange or the behavioiur is normal. As an example I am using dataset
Engel from the package and my own weights.
x<-engel[1:50,1]
y<-engel[1:50,2]
w<-c(0.00123, 0.00050, 0.00126, 0.00183, 0.00036, 0.00100,
0.00122,
2006 Aug 09
0
Weighted Mean Confidence Interval
Hello,
I'm looking to calculate a 95% confidence interval about my estimate for
a sample's weighted mean, where the calculated confidence interval would
equal the t-test confidence interval of the sample in the case when all
of the weights are equal.
My initial thought was to simply implement a modified version of the
t-test function but substituting the weighted variance and mean for the
2009 Feb 06
0
Comparing weighted histograms?
I'm trying to plot and compare weighted histograms and I can't seem find
where to start. I have data similar to this:
Miles2LAX RADAM2005Pct LAWA2005Pct
35.57 .00123 .00684
24.74 .00118 .00187
27.09 .00965 .00876
16.23 .00587 .00397
{ ...