similar to: Saving run time in loop

Displaying 20 results from an estimated 20000 matches similar to: "Saving run time in loop"

2006 Jan 15
8
/ Operator not meaningful for factors
Folks, I have a very basic question. The solution eludes me perhaps because of my own lack of creativity. I am not attaching a fully reproducible session because the issue may well be becuase of the way the data file is, and the data file is large (and I don't know whether I can legally distribute it). If people can suggest things that might be wrong in my data or the way that I am reading it,
2010 Jul 27
3
Right digits of a floating number
Hi all, I am dealing with very large numbers but I am only interested in their last digits. > 244^244 [1] Inf As far as I can tell, the largest number R can take has 308 digits (1+E308). Is there a way I could see the last digits only of 244^244? Many thanks for your help. Vincent Deluard, CFA. -- View this message in context:
2010 May 10
2
tapply function with NA
Hi R users, I have a matrix "m" of the type: m X4.20.2010 X4.19.2010 X4.16.2010 [1,] 0.008319468 0.00000000 -0.008250825 [2,] 0.005574136 0.01816118 0.073081608 [3,] -0.047830688 0.01612903 -0.030239833 [4,] NA NA NA [5,] 0.008746356 0.02848576 -0.025566107 [6,] -0.007990868 0.00000000 -0.026666667 I want to get the sum of each column. Normally
2012 Mar 05
8
Automating R script with Windows 7
Hi R-users, I am trying to automate the daily running of a simple R script from Windows 7. >From previous posts, I understand that this needs to be done with the task scheduler. I can schedule my laptop to automatically open R at a certain time, but not to execute a script. Secondary question: how do I save a list of R commands so that they get executed once the file is open? Right now, I
2010 Oct 21
2
Calculating variances in a moving window
I am trying to create basic descriptive statistics for a spatial dataset using moving windows of variable sizes. I found the filter(dataset, rep(1/a,1)) very useful for obtaining averages for a given moving window size "a" (a is the window size within a column of data in a matrix - the filter is applied to all columns automatically) I could not find anything analogous for
2010 May 06
1
How to rank matrix data by deciles?
Hi R users, I have a matrix of data similar to: > y=matrix(rnorm(55),ncol=5) I would like to know to which decile each number belongs compared to the numbers in its column. Say y[1,1] is the third decile among y[1:11,1] and y[2,1] is in the second decile I would like get a matrix that would return their ranks in decile, i.e., y[1,1] -> 3 y[2,1] -> 2 Your help is much appreciated!
2010 May 05
3
Read data from .csv file as a matrix
Hi R-users, I have a csv file that contains weather observation (rows) by days (in columns). I open using: > temp = read.csv("Weather.csv", sep=",") and read: X X1.Jan X2.Jan X3.Jan X4.Jan 1 Min 2 3 4 1 2 Max 6 10 8 6 3 Forecast Min 3 1 1 3 4 Forecast Max 8 7
2008 Aug 02
1
problem with nested loop for regression
Hi everyone, I'm experiencing difficulty getting the results I want when I use a nested for loop. I have a data set to which I perform some calculations, and then try to apply a regression over a rolling window. The code runs, but the regression results I am getting (intercept and slope) are simply the same, repeated again and again in the results matrix. The regression does not seem to be
2009 Sep 30
3
programming to calculate variance
Dear R-user Suppose I have the following data y=c(2,1,5,8,11,3,1,7,50,21,33,7,60) x=data.frame(y) for(i in 4:nrow(x)) x[i,] =var(x[i-3:i-1,]) I'm trying to get a new variable with the variance of the 3 previous values (just an example) and with NA in the three first positions. I know that my for() is wrong but I'm not able to find my error. Any idea? Thanks, Marlene.
2011 Nov 01
1
help with unequal variances
Hello, I have some patient data for my masters thesis with three groups (n=16, 19 & 20) I have completed compiling the results of 7 tests, for which one of these tests the variances are unequal. I wish to perform an ANOVA between the three groups but for the one test with unequal variance (<0.001 by both bartlett and levene's test) I am not sure what to do. I thought i would run
2013 Jun 27
3
using "rollapply" to calculate a moving sum or running sum?
#using "rollapply" to calculate a moving sum or running sum? #I am tryign to use rollapply to calcualte a moving sum? #I tried rollapply and get the error message #"Error in seq.default(start.at, NROW(data), by = by) : # wrong sign in 'by' argument" #example: mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) mymatrix_cumsum <- ( matrix(data=NA, nrow=5,
2012 Oct 22
1
Testing the equality of two variances
Dear R-User, I met the problem to test equality of variance. Two sample units: conjps<-c(9.41,10.45,10.78,10.73,11.11,11.12,11.59,11.04,11.63) ms<-c(4.11,5.10,5.70,6.46,6.04,6.16, 6.24,6.32,7.33) Then I use the F test to test: •Test Equality of Two Variances F test to compare two variances data: conjps and ms F = 0.5419, num df = 8, denom df = 8, p-value = 0.4045 alternative
2004 Jul 12
2
lme unequal random-effects variances varIdent pdMat Pinheiro Bates nlme
How does one implement a likelihood-ratio test, to test whether the variances of the random effects differ between two groups of subjects? Suppose your data consist of repeated measures on subjects belonging to two groups, say boys and girls, and you are fitting a linear mixed-effects model for the response as a function of time. The within-subject errors (residuals) have the same variance in
2004 Dec 19
1
Homogeneity of variance tests between more than 2 samples (long)
Dear all a couple of months ago i've found threads regard test that verify AnOVa assumption on homogeneity of variances. Prof. Ripley advice LDA / QDA procedures, many books (and many proprietary programs) advice Hartley's F_max, Cochran's minimum/maximum variance ratio (only balanced experiments), K^2 Bartlett's test, Levene's test. Morton B. Brown and Alan B. Forsythe in a
2011 Apr 04
1
moving mean and moving variance functions
Hello Lets say as an example I have a dataframe with the following attributes: rownum(1:405), colnum(1:287), year(2000:2009), daily(rownum x colnum x year) and foragePotential (0:1, by 0.01). The data is actually stored in a netcdf file and I'm trying to provide a conceptual version of the data. Ok. I need to calculate a moving mean and a moving variance for each cell on the following
2008 Apr 21
3
means and variances of several groups in the matrix
Dear R users, I have 32 observations in data x. After sorting this, I want to compute means and variances of 3 groups divided by "nr". Actually, the number of groups is flexible. Any suggestion will be greatly appreciated. Kathryn Lord --------------------------------------------------------------------------- x=rnorm(32) y=sort(x) nr=matrix(c(12,11,10,10,10,11),2,3) > nr
2010 Oct 04
1
Fixed variance structure for lme
I have a data set with 50 different x values and 5 values for the sampling variance; each of the 5 sampling variances corresponds to 10 particular x values. I am trying to fit a mixed effect linear model and I'm not sure about the syntax for specifying the fixed variance structure. In Pinheiro's book my situation appears to be similar to the example used for varIdent, where there is a
2012 Oct 29
2
Which test should I use for comparing the change of two samples
Dear All, I have two samples as the following: conjps<-c(9.41,10.45,10.78,10.73,11.11,11.12,11.59,11.04,11.63) ms<-c(4.11,5.10,5.70,6.46,6.04,6.16, 6.24,6.32,7.33) I want to test the change of sample is same to the another one. conjps_ch<-c(1.04,0.33.....) ms<-c(0.99,0.60,0.76....) which test I should use, which conclusion can we drive based on the test? I used the following
2011 Apr 21
1
one-way ANOVA model, with one factor, an unbalanced design and unequal variances
Hi, i'm looking for an R function to fit a one-way ANOVA with one factor containing 10 levels. The factor levels have different numbers of observations (varying between 20 to 40). For most of the dependent variables i'm testing there are unequal variances among the factor levels. I see the function oneway.test: oneway.test(variable ~ factor, data=dataset) which by default does not
2008 Jun 19
2
Create Matrix from Loop of Vectors, Sort It and Pick Top-K
Hi, I have the following dataset (simplified for example). __DATA__ 300.35 200.25 104.30 22.00 31.12 89.99 444.50 22.10 43.00 22.10 200.55 66.77 Now from that I wish to do the following: 1. Compute variance of each row 2. Pick top-2 row with highest variance 3. Store those selected rows for further processing To achieve this, I tried to: a) read the table and compute variance for each row,