similar to: Weighted variance function?

Displaying 20 results from an estimated 9000 matches similar to: "Weighted variance function?"

2018 Mar 22
1
Calculate weighted proportions for several factors at once
Hi, I have a grouped data set and would like to calculate weighted proportions for a large number of factor variables within each group member. Rather than using dplyr::count() on each of these factors individually, the idea would be to do it for all factors at once. Does anyone know how this would work? Here is a reproducible example: ############################################################
2009 Dec 14
1
New version weighted mean differs from the old one (PR#14142)
Full_Name: Myung-Hoe Huh Version: 2.10 OS: Windows Submission from: (NULL) (116.120.84.194) New Version (2.10.0) weighted mean produces unreasonable result: see below. wt <- c(5, 5, 4, 1)/15 x <- c(3.7,3.3,3.5,2.8) x[4] <- NA (xm <- weighted.mean(x,wt,na.rm=T)) Outcome is > (xm <- weighted.mean(x,wt,na.rm=T)) [1] 3.266667 The number is obtained
2012 May 07
1
Value of Hurst exponent (R/S) method > 1
Hello, I'm using fArma package to estimate the value of Hurst exponent using R/S method. However, for a certain set of data I get H ~ 1.8. How do I interpret this? Following are the output that I get for this set: > mean(data[,2]) [1] 400.5433 > sd(data[,2]) [1] 1139.786 > > rsFit(data[,2], levels = 64) Title: Hurst Exponent from R/S Method Call: rsFit(x = data[, 2], levels
2008 Apr 25
1
Summarize data for MCA (FactoMineR)
Hi :-) I'm new to R and I started using it for a project (I'm the CS guy in a group of statisticians helping them find out how to solve issues as they come out). This is my first post to the list and I am starting to learn R. Well, they were used to doing MCA analysis in other programs where the data seems to be preprocessed automatically before running MCA. So, they need to process a
2008 May 28
1
Grouped weighted.mean
Dear all -- I want to compute weighted.mean() for grouped rows. Data frame extract is just below. For each Key, I want the mean of IAC weighted by Wt. DP0[1:20,] Key IAC Wt 2 C3-PD030020050.PD030020050.3.12.3.0 0.765 0.8590000 3 C3-PD030020050.PD030020050.3.12.3.0 0.764 0.8449651 4 C3-PD030020050.PD030020050.3.12.3.0
2002 Feb 06
4
Weighted median
Is there a weighted median function out there similar to weighted.mean() but for medians? If not, I'll try implement or port it myself. The need for a weighted median came from the following optimization problem: x* = arg_x min (a|x| + sum_{k=1}^n |x - b_k|) where a : is a *positive* real scalar x : is a real scalar n : is an integer b_k: are negative and positive scalars
2011 Mar 02
2
Creating a weighted sample - Help
Hi I'm new to R and most things I want to do I can do but I'm stuck on how to weight a sample. I have had a look through the post but I can't find anything that addresses my specific problem. I am wanting to scale up a sample which has been taken based on a single variable (perf) which has 4 attributes H,I, J and K. The make up of the sample is shown below:- Perf Factored
2009 Oct 10
1
many weighted means: is there a simpler way?
Hi R-users, I would like to calculate weighted mean of several variables by two factors where the weight vector is the same for all variables. Below, there is a simple example where I have only two variables: "v1","v2" both weighted by "wt" and my factors are "gender" and "year". set.seed(1) df <- data.frame(gender = rep(c("M",
2011 Dec 08
1
sum of deviations from the weighted mean
Hi all. I tried to calculate sum of deviations from the weighted mean and i didn't get what i expected - 0. Here is an example: > wt <- c(10,25,38,22,5) > x <- 6:10 > wm <- weighted.mean(x,wt) > (x-wm)*wt [1] -18.70 -21.75 4.94 24.86 10.65 > sum((x-wm)*wt) [1] -1.24345e-14 With simple mean I got 0: > sum(x-mean(x)) [1] 0 Could someone explain me why we
2008 May 19
2
Converting variance covariance matrix to correlation matrix
Suppose I have a Variance-covariance matrix A. Is there any fast way to calculate correlation matrix from 'A' and vice-versa without emplying any 'for' loop? [[alternative HTML version deleted]]
2003 May 22
1
Plot observed vs. fitted values (weighted nls)
Dear WizaRds, Given the experimental data, csdata<-data.frame( time=c(0,1,3,9,20), conc=c(638.697,395.69,199.00,141.58,112.16) ) weighted nls is applied, wt.MM<- function(resp, time,A1,a1,A2,a2) { pred <- A1*exp(-a1*time)+A2*exp(-a2*time) (resp - pred) / sqrt(pred) } # cs.wt <- nls( ~ wt.MM(conc, time,A1,a1,A2,a2), data=csdata,
2011 Jan 19
1
buglet in weighted.residuals(mlmObject)
When weighted.residuals() is given a fitted model object with several responses (class mlm) and some zero weights it returns a vector instead of a matrix. It looks like it is doing resids[ weights != 0 ] instead of resids[ weights != 0, , drop=FALSE] in the multi-response case. E.g., > d4 <- data.frame(y1=1:4, y2=2^(0:3), wt=log(1:4), fac=LETTERS[c(1,1,2,2)]) > fit <-
2011 Aug 28
4
How do I get a weighted frequency table?
? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110828/d35f51a1/attachment.pl>
2012 Mar 22
1
Simalteneous Equation Doubt in R
Hi List l am interested in developing price model. I have found a research paper related to price model of corn in US market where it has taken demand & supply forces into consideration. Following are the equation: Supply equation: St= a0+a1Pt-1+a2Rt-1+a3St-1+a5D1+a6D2+a7D3+U1 -(1) Where D1,D2,D3=Quarterly Dummy Variables(Since quarterly data are considered) Here, Supply
2012 Jun 21
4
crosstable and regression for survey data (weighted)
I have survey data that I am working on. I need to make some multi-way tables and regression analyses on the data. After attaching the data, this is the code I use for tables for four variables (sweight is the weight variable): > a <- xtabs(sweight~research.area + gender + a2n2 + age) > tmp <- ftable(a) Is this correct? I don't think I need to use the strata and cluster
2012 Jul 17
1
weighted mean by week
Hello! I wrote a code that works, but it looks ugly to me - it's full of loops. I am sure there is a much more elegant and shorter way to do it. Thanks a lot for any hints! Dimitri # I have a data frame: x<-data.frame(group=c("group1","group2","group1","group2"), myweight=c(0.4,0.6,0.4,0.6),
2005 Jun 16
1
mu^2(1-mu)^2 variance function for GLM
Dear list, I'm trying to mimic the analysis of Wedderburn (1974) as cited by McCullagh and Nelder (1989) on p.328-332. This is the leaf-blotch on barley example, and the data is available in the `faraway' package. Wedderburn suggested using the variance function mu^2(1-mu)^2. This variance function isn't readily available in R's `quasi' family object, but it seems to me
2003 Oct 30
2
'nls' and its arguments
Dear R experts! I'd to fit data by 'nls' with me-supplied function 'fcn'. 1) I'd like 'fcn' to accept arbitrary arguments, i.e. I defined it as f(...) {<body>}. (Ok, that's not actually impotant). 2) Second, I would NOT like to supply every parameter in the formula. To illustrate this, let's look at the last example of 'nls' help
2008 Sep 30
0
calculating weighted correlation coefficients
Dear Help, I'm trying to calculate a weighted correlation matrix from a data frame with 6 columns (variables) and 297 observations extracted from the regression. The last column is a weight column which I want to apply. $ model :'data.frame': 297 obs. of 6 variables: ..$ VAR1 : num [1:297] 5.21 9.82 8.08 0.33 8.7 6.82 3.94 4 0 5 ... ..$ VAR2 : num [1:297]
2010 Feb 22
2
Siegel-Tukey test for equal variability (code)
Hi, I recently ran into the problem that I needed a Siegel-Tukey test for equal variability based on ranks. Maybe there is a package that has it implemented, but I could not find it. So I programmed an R function to do it. The Siegel-Tukey test requires to recode the ranks so that they express variability rather than ascending order. This is essentially what the code further below does. After the