search for: normwt

Displaying 7 results from an estimated 7 matches for "normwt".

2007 May 31
3
Problem with Weighted Variance in Hmisc
The function wtd.var(x,w) in Hmisc calculates the weighted variance of x where w are the weights. It appears to me that wtd.var(x,w) = var(x) if all of the weights are equal, but this does not appear to be the case. Can someone point out to me where I am going wrong here? Thanks. Tom La Bone [[alternative HTML version deleted]]
2006 Mar 16
4
problem for wtd.quantile()
Dear R-users, I don't know if there is a problem in wtd.quantile (from library "Hmisc"): -------------------------------- x <- c(1,2,3,4,5) w <- c(0.5,0.4,0.3,0.2,0.1) wtd.quantile(x,weights=w) ------------------------------- The output is: 0% 25% 50% 75% 100% 3.00 3.25 3.50 3.75 4.00 The version of R I am using is: 2.1.0 Best,Jing
2007 Jul 23
1
replacing double for loops with apply's
...ply(x[(i-4):i,],2,var,na.rm=T) # ------------------------------------------------------- x = matrix(rnorm(200),10,20) sdx = matrix(0,10,20) for(i in 5:nrow(x)){ wts = ( 0.5 )^(i-c(1:i)) wts = wts/sum(wts) sdx[i,] = apply(x[1:i,],2,wtd.var,weights=wts,normwt=T, na.rm=T) } [[alternative HTML version deleted]]
2006 Jul 04
1
using weights in lrm
...+ h.div1 + h.fail1 + h.sex + h.ch.1 + h.ch.5 + h.ch.12 + h.ch.13 + h.popgroup + y.school.now ,x=T,y=T, data=d.caps1y, weights=weightsd, normwt=TRUE ) The regression works (in the sense that the results are not way off the one w/o wighting the sample), but I get the following warning messages: Warning messages: 1: number of items to replace is not a multiple of replacement length 2: currently weights are ignored in mode...
2006 Nov 14
1
Using lrm
...lrm(formula, data, subset, na.action=na.delete, method="lrm.fit", model=FALSE, x=FALSE, y=FALSE, linear.predictors=TRUE, se.fit=FALSE, penalty=0, penalty.matrix, tol=1e-7, strata.penalty=0, var.penalty=c('simple','sandwich'), weights, normwt, ...) Any logistic regression model would take y and x1,x2,x3 as parameters and output the model (probabilities). So, I dont know where to fit in these values in this function. Any help is appreciated. I am chasing a deadline in my project. Nitin [[alternative HTML version deleted]]
2012 Nov 19
5
help on matrix column removal based on another matrix results
...ite.table(NSEr, "NSEr_minus0.6.csv", sep =",") > NSEr <- NSEr/sum(NSEr) > write.table(NSEr, "NSEr_normalized.csv", sep =",") > #NSEr = sum(NSEr) > limits <- apply(Vsim, 1, "wtd.quantile", weights = NSEr, probs = > c(0.05,0.95), normwt=F) -- View this message in context: http://r.789695.n4.nabble.com/help-on-matrix-column-removal-based-on-another-matrix-results-tp4650043.html Sent from the R help mailing list archive at Nabble.com.
2006 Aug 09
0
Weighted Mean Confidence Interval
...dified version of the t-test function but substituting the weighted variance and mean for the unweighted variance and mean. For example: weighted.ttest.ci <- function(x, weights, conf.level = 0.95) { require(Hmisc) nx <- length(x) df <- nx - 1 vx <- wtd.var(x, weights, normwt = TRUE) ## From Hmisc mx <- weighted.mean(x, weights) stderr <- sqrt(vx/nx) tstat <- mx/stderr ## not mx - mu alpha <- 1 - conf.level cint <- qt(1 - alpha/2, df) cint <- tstat + c(-cint, cint) cint * stderr } However, in the below extreme case where th...