statistics

Function that returns integer with specific distribution

孤街浪徒 提交于 2019-12-13 04:57:53
问题 I am looking for a distribution or rather a function that returns an integer in a specific range with decreasing probability the higher the number. Lets say the range is from 1 to 5. 85% of the time the function should return 1 8% of the time the function should return 2 4% of the time the function should return 3 2% of the time the function should return 4 1% of the time the function should return 5 Additionally it would be great if the probabilities are according to a set distribution say

how to plot joint distribtuion of 2 random variable having 1000 data

ⅰ亾dé卋堺 提交于 2019-12-13 04:07:20
问题 here is the code i wrote to generate probability distribtuion of two random variable. now i would like to plot JPD. clear all; clc; x1 = randn(1000,1); x2 = 10*randn(1000,1); [count_1, b] = hist(x1, 25); %25 bins pd1 = count_1 / length(x1) / (b(2) - b(1)); % probability distribution function of x1 [count_2, bn] = hist(x2, 25); %25 bins pd2 = count_2 / length(x2) / (bn(2) - bn(1)); % probabitlity distribtuion function of x2 %subplot(2,2,1), plot(x,s1) %subplot(2,2,2),plot(x,s2) %subplot(2,2,1)

What is a dimnames error when estimating GLS?

房东的猫 提交于 2019-12-13 04:06:06
问题 I've Googled around quite a bit and can't find documentation on this. I'm trying to estimate a feasible generalized least squares (FGLS) model on cross-sectional time series data in R. For example: library(nlme) foo <- gls(Y ~ factor(panel_ID) + X1 + X2, data = myData, correlation=corARMA(p=1), method='ML', na.action=na.pass) When I run this (my data frame is quite large, which is why I don't include it here), I get the following error: # Error in array(c(X, y), c(N, ncol(X) + 1), list(row

test arima model

别来无恙 提交于 2019-12-13 03:39:37
问题 I am validating Arima models and I would like to know the critical value of my test to reject the null hypthesis depending on the p-value. If a want a confidence of 95%. which is my critical value. 1-pchisq(-2*(try2$loglik-try1$loglik),1) 0.1817151 1-pchisq(-2*(try3$loglik-try2$loglik),1) 1 Where try1, try2 and try3 are three different models. Thanks! 回答1: You need to provide a little bit more info, but I think I see what you're trying to do. Your null hypothesis is that the two models do not

Are these memcached stats normal?

让人想犯罪 __ 提交于 2019-12-13 03:28:06
问题 Are these stats normal? I have problems with my PHP products, so I want to know if these data are healthy stats STAT pid 2312 STAT uptime 5292037 STAT time 1253692925 STAT version 1.2.8 STAT pointer_size 64 STAT rusage_user 2600.605647 STAT rusage_system 9533.168738 STAT curr_items 1153303 STAT total_items 139795434 STAT bytes 435570863 STAT curr_connections 288 STAT total_connections 135128959 STAT connection_structures 1018 STAT cmd_flush 1 STAT cmd_get 171491050 STAT cmd_set 139795434 STAT

Writing loop/function to generate various linear regressions on same dataframe

試著忘記壹切 提交于 2019-12-13 03:16:04
问题 I am writing loops or functions in R, and I still haven't really understood how to do that. Currently, I need to write a loop/function (not sure which one would be better) to create several linear regression models within the same data frame. I have data like this: dataset <- read.table(text = "ID A_2 B_2 C_2 A_1 B_1 C_1 AGE M1 10 6 6 8 8 9 25 M2 50 69 54 67 22 44 16 M3 5 80 44 78 5 55 18 M4 60 70 52 89 3 56 28 M5 60 5 34 90 80 56 34 M6 55 55 67 60 100 77 54", header = TRUE, stringsAsFactors

using a relational database to store results from head-to-head(-to-head) gaming

对着背影说爱祢 提交于 2019-12-13 03:12:12
问题 I've got a site where people record game results. 95% of the games are played solo, but the 5% that aren't throw off the win-draw-win statistics for each scenario. Each battle has 2 sides, and all possible results are: Side 1 wins Side 2 wins Draw If 2 people play each other, and both record a play, you get 2 wins for a given side when there should only be one, (making sense?) and it throws off the balance rating. Those records should be merged when it comes time to display the battle's stats

Only one of two densities is shown in ggplot2

血红的双手。 提交于 2019-12-13 03:04:33
问题 So I have two sets of data (of different length) that I am trying to group up and display the density plots for: dat <- data.frame(dens = c(nEXP,nCNT),lines = rep(c("Exp","Cont"))) ggplot(dat, aes(x = dens, group=lines, fill = lines)) + geom_density(alpha = .5) when I run the code it spits an error about the different lengths, i.e. "arguments imply different num of rows: x, y" I then augment the code to: dat <- data.frame(dens = c(nEXP,nCNT),lines = rep(c("Exp","Cont"),X)) Where X is the

Getting values from indicator variables in R

谁都会走 提交于 2019-12-13 02:38:51
问题 Firstly I had to model the coordinates of two points in a 20m X 30m rectangle. Obviously these points follow a uniform distribution so this is the first part of my code: X1 <- runif(1,0,20) X2 <- runif(1,0,30) point1 <- c(X1,X2) point1 I used the same code for the second point ('point2') but replaced the X1 and X2 with Y1 and Y2 respectively. I then had to find the distance between the two points: distance <- sqrt(((X1-Y1)^2)+((X2-Y2)^2)) Now if I define A as the event where the points are

Trying to display NONE when there is no mode in R

℡╲_俬逩灬. 提交于 2019-12-13 01:43:17
问题 I am trying to figure the mode of a data set, while displaying "NONE" if there is no mode. I am currently using Gregor's function as commented below. examples: {1,1,2,2,3} Expected results 1 2 (success) {NA,NA,NA,1,1,1,3,3} Expected results NA 1 (success) {1,2,3,4,5} Expected result NONE (success) {1,1,1,1,1} Expected result 1 (fail) EDIT: I am trying out with if...and functions, as I realize there seems to be some logical problems. But I can't seem to crack it smode<-function(x,...) { ux <-