Questions tagged [mean]

The arithmetic mean (or simply the mean or average when the context is clear) is the central tendency of a collection of numbers. The mean is calculated as the sum of the numbers divided by the size of the collection.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

reduction of monthly Landsat and MODIS values

Could someone tell me what could be causing the following error? It turns out that I want to extract monthly values from a Landsat collection and when I do it for Landsat I can do it without problem. ...
Carlos Javier Navarro's user avatar
2 votes
2 answers
56 views

Rolling mean across day of year

In my example below, I can calculate a centered 7-day rolling mean however, the first three days and the last three days are NA values. The rolling mean should take into account that day 365 is ...
tassones's user avatar
  • 992
0 votes
0 answers
23 views

Utility of geometric mean throughput in system level performance

In the simulation (5G in-house simulator), while evaluating the system-level performance I observed that along with the arithmetic mean throughput it also considers the geometric mean throughput of ...
Aragorn's user avatar
  • 111
1 vote
3 answers
52 views

Cummean ignoring NAs and replacing NA with last valid value

Similar to this post Calculate cummean() and cumsd() while ignoring NA values and filling NAs but I would rather stick to tidyverse My data: structure(list(season = c("Winter", "Winter&...
piblo95's user avatar
  • 173
0 votes
0 answers
26 views

Unsure how to process data to get mean observations per day while maintaining subcategories

I'm looking for help with a problem I've got a data frame with observations from 8 days and I'd like to make a bar graph of the mean number of observations per day for each observation point (factor A)...
Bethy's user avatar
  • 1
0 votes
0 answers
36 views

Use R to acquire Q1 temp data from individual month files containing daily data (336 files total)

I wish to calculate the mean temperature data for 1 km grid cells from a list of csv files containing 1 km grid cell max and min daily values for individual months. Here are the numbers of files I am ...
Onemind99's user avatar
0 votes
1 answer
48 views

numpy nanmean in numba

I am trying to write a simpler version of numpy.nanmean for numba. Here's my code: from numba import jit, prange import numpy as np @jit(nopython=True) def nanmeanMY(a, axis=None): if a.ndim>1:...
user9875321__'s user avatar
0 votes
2 answers
63 views

Rolling Mean Window Size [duplicate]

I'd like to calculate a rolling mean for a window size of 2, while excluding NaNs as counting as part of the window size. I'd like a rolling mean of the "last 2 non null values". I don't ...
greenguy's user avatar
0 votes
2 answers
20 views

How do I construct a loop to make conditional means in R?

I have a dataset in which observations are ranked based on priority. I want to find the conditional mean of one variable (whether or not they like the color red (1 or 0)) by groups of 100. That is, I ...
Questionasker's user avatar
-1 votes
2 answers
52 views

Python: Get mean and std dev from input using OOP

I have solved the following program to get mean and std dev from user's input, but I have the strong feeling that can be improved, mainly as I have to duplicate the split function, I had to do that ...
Otoniel Ramirez's user avatar
0 votes
1 answer
15 views

Converting Dataframe with Group Means and Standard Deviations in R

I have a large dataset with four variables, like this: Public_Issue Voter_Partisanship Population value 2 non-partisan Politicians 40 2 moderately-partisan Voters 42 2 moderately-partisan ...
lwe's user avatar
  • 349
0 votes
1 answer
25 views

Different mean symbols on violin plots using facet_grid

I would like to have the triangle mean symbol changed to open on the green violin plots when using facet_grid. Using ggplot2 I can get this on the single graphs (like the one below) by including '...
Len's user avatar
  • 31
0 votes
1 answer
118 views

How can I find the mean and average expression in my violin plot using R?

I have plotted my violin plots, but I am trying to find the mean and average expression at each of my time points. Here is the code that I have used: VlnPlot(spinalcord_neurons, features = c("...
Emma 's user avatar
1 vote
1 answer
32 views

Calculate the mean germination per species per week

I got a dataset where I recorded the germination of seeds from different species (Species) in different soil types (Soil_origin) weekly. I got four replicas for each species, in other words: for each ...
Stefanie van den Berg's user avatar
0 votes
1 answer
72 views

Why is my numpy mean outcome different from calculating the mean by excel?

So my dataset, aka "filtered_test.xlsx" contains a dataset of the information regarding some Hotels in the US with stuff like ratings. So I want to calculate the mean average ratings grouped ...
heyshh's user avatar
  • 5
1 vote
2 answers
43 views

How can I change values in a column without knowing how many columns I have in the dataframe in r?

I have a matrix df <- matrix(c(9185, 3661, 9539, 4266, 9650, 3897, 9160, 4451), nrow = 2, ncol = 4) and I want calculate: (element - mean(by row))/ sd(by row) . Ex: (9185 - 9383,5)/248,03 and ...
Fred's user avatar
  • 81
2 votes
2 answers
102 views

How to calculate mean (Expected Value) of a custom continuous distribution from the probability density in R

The probability density and the calculation for the mean "by hand" are given below: I have coded the probability density function as: myfunc <- function(x){ ifelse(x >= 0 & x &...
Reader 123's user avatar
0 votes
1 answer
18 views

Is there a way to get the average over X minutes while also averaging based on groups in R?

I'm trying to get the average temperature over a certain amount of time (ex. 30 min) based on the groupings in the code below group_by(Type, Rainfall, datetime). I'm thinking this is something I'll ...
Sien Smania's user avatar
0 votes
2 answers
35 views

in R how do I easily find the first x instances of a varibale in a table, ideally using dplyr?

I have the following dataframe ID <- c(1,1,1,1,1,1,1,2,2,2,2,2,2,2,2, 3,3,3,3,3,3, 3,3,3,3,3,3) reversal = c('R0', 'R0', 'R0', 'R0', 'R1', 'R1', 'R1', 'R0', 'R0', 'R0', 'R0', 'R1', '...
Chiara Toschi's user avatar
0 votes
0 answers
39 views

mean function throws error "Index exceeds the number of array elements. Index must not exceed 1"

I am trying to find the arithmetic mean of a vector in MATLAB. However, when I pass my array into the mean function, it throws the error "Index exceeds the number of array elements. Index must ...
phantombees's user avatar
-4 votes
1 answer
51 views

Calculate mean for variables in txt files [closed]

I need to calculate the mean for TRODRY and TROWET for this text file in python , since I have many files of this text file my file format is as follows: %=TRO 0.01 EMR 23:208:83100 EMR 21:005:00030 ...
Mohamed Hatem's user avatar
0 votes
2 answers
61 views

Calculate average between mean and 1st standard deviation

I have an array: import numpy as np # Create an array of values values = np.array([41,17,44,36,14,29,33,38,49,39,22,15,46]) # Calculate the mean mean = np.mean(values) # Calculate the standard ...
Jose Luis Landivar S's user avatar
0 votes
0 answers
14 views

How to measure rate in telegraf using hot-shots

I am using hot-shots module in Node to send measurements to telegraf, which then sends data to influx db. I want to measure exact cache hit rate. My collection interval is 1s. I use gauge to store ...
dzuremar's user avatar
  • 170
2 votes
1 answer
26 views

Mean() not working with functions as arguments within a pie

I'm a beginner with R. I'm doing some exercises on data manipulation with dplyr, and I'm encountering something I don't quite understand. I'm with an exercise which uses the 'titanic' training dataset ...
Xavier Villà Aguilar's user avatar
0 votes
0 answers
19 views

Entering means, standard deviations and numbers in sample

In Stata, I have, For example, low physical activity for people aged 18-24: mean=45.5, SD=2.23, number in sample=2672 low physical activity for people aged 75 and above: mean=68.07, SD=3.11, number in ...
Mehran Shakerinava's user avatar
0 votes
0 answers
5 views

How can I find the mean value of a column having two elements Weekday and Weekend

SyntaxError: unmatched ']' The above error message was returned #get the mean delivery time on weekdays and print it mean_delivery_time_on_weekends = df['day_of_the_week'] = 'Weekend'][delivery_time]....
Chidi's user avatar
  • 1
0 votes
1 answer
16 views

How can Apache IoTDB retain two decimal places of average value after query aggregation?

After query aggregation in Apache IoTDB, can average calculate avg retain two decimal places in IoTDB? If this can be done, what settings should I install? If this cannot be done, are there any other ...
NKZ's user avatar
  • 47
0 votes
1 answer
11 views

Where can I find the YAML file that governs my "Pages Build and Deployment" Job

Haven't touched my repro since 2017 and I've forgotten where the YAML or configuration file is for "Pages Build and Deployment" job is. The Github UI doesn't seem to point to a specific job(...
NanoNet's user avatar
  • 212
0 votes
1 answer
43 views

How do I create a mean variable excluding zeros using proc sql in SAS?

I have 5 variables: Academicyear, dept, InstrGID curenr credit_hours I need the mean of credit hours grouped by Academic year, dept, and InstrGID. The mean must exclude the zeros when "curenr&...
Elizabeth's user avatar
0 votes
0 answers
21 views

How to calculate mean from hundreds of rasters in R

I have a folder of ~39,000 raster files (.tif format). Each raster has NDVI of a day at a nest box location (440 total) in a buffer in either 2022 or 2023. I want to calculate the average NDVI at each ...
hlambeau's user avatar
1 vote
1 answer
48 views

Can I calculate the mean/mode of a variable (by another variable) and tabulate in R?

I want to find the mean (for numerical variables) and mode (for character variables) for each of the variables under column "trait_name" for each unique "taxon_name". I would then ...
user avatar
0 votes
0 answers
30 views

How to explain discrepancies between emmeans output and means?

I'm using a quasibinomial model in R with a dependent variable and several independent variables (both numeric and dummy variables). I've used Anova(mymodel) to test which independent variable affect ...
statuser's user avatar
-1 votes
1 answer
40 views

How to calculate the mean time between two datetime columns?

I am trying to calculate the mean time spent between two columns named started_at and ended_at. Their format is "datetime". I then want to show my results group_by the values of my column ...
Nicolas Grisé's user avatar
0 votes
1 answer
27 views

How can add the average value of different categories in ggplot?

I want to add the mean values(text or vertical lines) for 4 categories (2 year * 2 treatments) when applying facet_wrap. I've already tried group_by, but it can only work on 2 categories (year or ...
Chouette's user avatar
  • 153
0 votes
1 answer
30 views

Add mean values of different periods of a time series in ggplot

I am analyzing a time series and I would like to show in ggplot the mean values and the confidence intervals calculated on different time series periods, like in the attached graph. How can I do that?
AUS85's user avatar
  • 175
1 vote
1 answer
37 views

How to get average/mean with mapping in pandas dataframe? [duplicate]

I have a dataframe that looks something like this: Birthyear Weight 1992 2 1993 2.2 1992 3 1993 2.5 1994 2.4 1993 1.8 1994 2.1 Note: This is an example, I have +100k of rows and years I want ...
Tabare De Los Santos's user avatar
1 vote
1 answer
82 views

Mean filter on 2D array with Numpy, SciPy or Scikit-image

I'm looking for a 2D mean filter with 3x3 window. I tried NumPy: a = np.arange(25).reshape(5, 5) b = np.average(a, axis=(0, 1), weights=np.ones((3, 3))) but it fails with: TypeError: 1D weights ...
Paul Jurczak's user avatar
  • 7,144
0 votes
0 answers
25 views

how ro Plot correctly the mean of means with geom_hlines and yintercept

I am trying to create a violin plot using ggplot2 of samples and on top to draw the mean of means. How does ggplot_boxplot calculates the means of the samples and how can I calculate this and have the ...
sunta3iouxos's user avatar
1 vote
1 answer
43 views

How do I alculate 2 means per subject differentiated by a variable in R

This is my first question on stack noverflow. I have tried some reasearch, but I am not getting there. I am trying to calculate two differents means per subjet which are differentiated by a variable ...
Maike Wuerzburg's user avatar
0 votes
2 answers
88 views

How to fit multiple average (horizontal) lines in ggplot in R

I want to fit multiple horizontal lines to a plot, where each line represents the mean of a different category in my data. lets say I have the following data frame product <- c("A","...
Joe the Second's user avatar
0 votes
1 answer
80 views

Why does Dunn's post hoc test & CDL output shows different CLD for two treatments with the same mean?

I've been working with a Kruskal wallis non-parametric test in R and following it up with Dunn's multiple comparison's test. Looking at the results of glyphosate H&S(abc) comparisons with others ...
E10's user avatar
  • 13
1 vote
1 answer
44 views

How can I use group_by and mutate together to calculate the means of certain columns?

I am trying to calculate the means of four groups. My data frame looks something similar to the following: Sex <- c("F", "F", "M", "M", "F") ...
Adriana's user avatar
  • 105
0 votes
0 answers
19 views

Python scaling to a fixed range, while keeping mean close to 0

Python experts, Similar questions have been asked multiple times, but I couldn't find an ideal solution to my problem. I have a long series of mean normalized data (mean of 0, range of [-6, 11]), and ...
Jasper's user avatar
  • 63
0 votes
2 answers
48 views

Standardizing each observation using the mean and standard deviation calculated using only prior observations

I am able to Standardizing each observation for the variable "len" using the mean and standard deviation calculated from only prior observations. However, I am uable to attach it as a column ...
Es003's user avatar
  • 21
0 votes
0 answers
16 views

How do I sort products by number of reviews and number of positive and negative reviews?

I am working on my side project, where I want to sort doctors' profiles at my website via a "sort best by reviews" button. I need to write polynomial for it, while having following factors ...
scurpuleux's user avatar
0 votes
0 answers
12 views

R - calculate the mean of values separated by NAs in a dataframe

I feel this should be very easy, but I cannot find a solution. I am using Rstudio (R version 4.2.1) on Windows 10. I have a data frame df that contains a column where cells contain either numeric ...
flix's user avatar
  • 13
0 votes
2 answers
81 views

Mean imputation return None and Nan in Dataframe

I want to fill in the missing values of two columns with the mean method. I type of the two columns is float64. df['col1'].dtypes dtype('float64') df['col2'].dtypes dtype('float64') I used two ...
Encipher's user avatar
  • 1,384
0 votes
0 answers
8 views

How can I include jitter and geopoint

I am currently working on a code that involves representing the mean standard deviation of the total weight of species collected over forest stands containin shelterbelts (Yes, No) further I want the ...
Madelein Victor's user avatar
1 vote
1 answer
40 views

Is there another way to represent the confidence interval as an error bar?

I am currently working on a code that involves representing the mean standard deviation of the total weight of species collected over forest stands containin shelterbelts (Yes, No) further I want the ...
Madelein Victor's user avatar
-1 votes
2 answers
38 views

what is the R code to calculated a mean and standard deviation of multiple mean and standard deviations?

what is the R code to calculated a mean and standard deviation of multiple mean and standard deviations? each has its own number of items... I tried to search online and in this forum but there was no ...
giovanni_1983's user avatar

1
2 3 4 5
79