variance

How to calculate standard deviation of circular data

耗尽温柔 提交于 2020-02-24 03:54:30
问题 I've followed the advice laid out here for calculating the average of circular data: https://en.wikipedia.org/wiki/Mean_of_circular_quantities But I'd also like to calculate standard deviation as well. #A vector of directional data (separated by 20 degrees each) Dir2<-c(350,20,40) #Degrees to Radians D2R<-0.0174532925 #Radians to Degrees Rad2<-Dir2 * D2R Sin2<-sin(Rad2) SinAvg<-mean(Sin2) Cos2<-cos(Rad2) CosAvg<-mean(Cos2) RADAVG<-atan2(SinAvg, CosAvg) DirAvg<-RADAVG * R2D The above gives me

Covariance and Contravariance with Func in generics

断了今生、忘了曾经 提交于 2020-01-31 08:46:05
问题 I need more information about variance in generics and delegates. The following code snippet does not compile: Error CS1961 Invalid variance: The type parameter 'TIn' must be covariantly valid on 'Test.F(Func)'. 'TIn' is contravariant. public interface Test<in TIn, out TOut> { TOut F (Func<TIn, TOut> transform); } The .net Func definition is as follows: public delegate TResult Func<in T, out TResult> (T arg); Why the compiler complains about TIn being contravariant and TOut - covariant while

how to allow for factor-specific variance of random effect in lme

吃可爱长大的小学妹 提交于 2020-01-21 05:06:24
问题 I assume that the random effects variances in my mixed effect model will be different for different levels of the fixed factor BTyp . Here is my model fm2 <- lme(CA ~ 1 + pF+Tiefe+BTyp+Tiefe:pF+BTyp:pF, data=data2, random = list(~ 1 + pF|Probe)) fm2_Btyphet<-update(fm2, weights=varIdent(form=~1|BTyp)) I managed to incorporate Btyp -specific variances for random effects using lmer function, but this function does not allow to consider variance heterogeneity of the within group error (which is

Variance rules in C#

你说的曾经没有我的故事 提交于 2020-01-12 14:25:28
问题 The Exact rules for variance validity are a bit vague and not specific. I'm going to list the rules for what makes a type valid-covariantly, and attach some queries and personal annotations to each of those rules. A type is valid covariantly if it is: 1) a pointer type, or a non-generic type. Pointers and non-generic types are not variant in C#, except for arrays and non-generic delegates. Generic classes, structs and enums are invariant. Am I right here? 2) An array type T[] where T is valid

Variance rules in C#

不羁岁月 提交于 2020-01-12 14:23:12
问题 The Exact rules for variance validity are a bit vague and not specific. I'm going to list the rules for what makes a type valid-covariantly, and attach some queries and personal annotations to each of those rules. A type is valid covariantly if it is: 1) a pointer type, or a non-generic type. Pointers and non-generic types are not variant in C#, except for arrays and non-generic delegates. Generic classes, structs and enums are invariant. Am I right here? 2) An array type T[] where T is valid

Population Variance in r

╄→гoц情女王★ 提交于 2020-01-12 04:30:21
问题 How can I calculate the population variance of my data using R? I read there is a package called popvar but I have the Version 0.99.892 and I don't find the package 回答1: The var() function in base R calculate the sample variance, and the population variance differs with the sample variance by a factor of n / n - 1 . So an alternative to calculate population variance will be var(myVector) * (n - 1) / n where n is the length of the vector, here is an example: x <- 1:10 var(x) * 9 /10 [1] 8.25

Read from File Variance Calculation

孤人 提交于 2020-01-07 04:55:11
问题 @Jerry Coffin I get the logic, while(File>>value)//while input just taken from file is true .... do computation. Yet when I implemented this the counter only went to 1 & it's value was very high. Sometime is wrong, but I have no idea what. The file is valid File.open(FileName, ifstream::in); while(File>>value){ ++counter; sum += value; sumsqr+= value * value; } average=sum/counter; variance = sumsqr/counter - average*average; File.close(); here's the contents of the input file I am using

How to retrieve correlation matrix from glm models in R

无人久伴 提交于 2020-01-03 05:12:07
问题 I am using the gls function from the nlme package. You can copy and paste the following code to reproduce my analysis. library(nlme) # Needed for gls function # Read in wide format tlc = read.table("http://www.hsph.harvard.edu/fitzmaur/ala2e/tlc.dat",header=FALSE) names(tlc) = c("id","trt","y0","y1","y4","y6") tlc$trt = factor(tlc$trt, levels=c("P","A"), labels=c("Placebo","Succimer")) # Convert to long format tlc.long = reshape(tlc, idvar="id", varying=c("y0","y1","y4","y6"), v.names="y",