r statistic hypothesis how to test

Produce 10 random observations from a normal distribution with mean 80 and typical deviation 30 Let's pretend that we do not know the mean μ of the distribution. Using the sample ,check(test) the 2 hypothesis H0 : µ = 80 vs H1 : µ not equal 80. Repeat the process for 100 times and record only the p-value each time. Using the 5% significance level to comment your results Show all the val

r统计假设如何检验

从均值为80和典型偏差的正态分布中产生10个随机观察值我们假设我们不知道分布的均值μ。 使用样本,检查(测试)2假设 H0:μ= 80与H1:μ不等于80。 重复此过程100次,每次只记录p值。 使用5%的显着性水平来评论你的结果显示所有的p值的值。 这是我做的 t<-c( rnorm(10, mean = 80, sd = 30)) t.test (y, mu = 80) t.test(y, mu =80, alternative = ”greater”)$p.value t.test(y, mu = 80, alternative = ”less”)$p.v

Use R to to test hypothesis of correlation = .5

I am trying to make a hypothesis test for my correlation H0: r= .5, H1: R != .5. R works fine for testing the hypothesis H0: r= 0. I looked online to see if any parameter in "cor.test" allowed me to change the hypothesis test but it is not available. cor.test(x, y, alternative = c("two.sided", "less", "greater"), method = c("pearson", "ken

用R来检验相关性假设= 0.5

我试图对我的相关性H0进行假设检验:r = .5,H1:R!= .5。 R对测试假设H0:r = 0很好。我在网上查看“cor.test”中的任何参数是否允许我改变假设检验,但它不可用。 cor.test(x,y,alternative = c(“two.sided”,“less”,“greater”),method = c(“pearson”,“kendall”,“spearman”),exact = NULL,conf。级别= 0.95,连续性= FALSE,...) 这是我的代码 > avgTemp [1] 21 24 32 47 50 59 68 74 62 50 41 30 >

R: cor.test by group with ddply

I am trying to calculate the correlation between two numeric columns in a data frame for each level of a factor. Here is an example data frame: concentration <-(c(3, 8, 4, 7, 3, 1, 3, 3, 8, 6)) area <-c(0.5, 0.9, 0.3, 0.4, 0.5, 0.8, 0.9, 0.2, 0.7, 0.7) area_type <-c("A", "B", "A", "B", "A", "B", "A", "B", "A", "B") data_frame <-data.frame(concentration, area, area_type) In this exa

R:由ddply组测试

我正在尝试计算数据框中两个数字列之间的关联,以确定每个因子的级别。 这是一个示例数据框架: concentration <-(c(3, 8, 4, 7, 3, 1, 3, 3, 8, 6)) area <-c(0.5, 0.9, 0.3, 0.4, 0.5, 0.8, 0.9, 0.2, 0.7, 0.7) area_type <-c("A", "B", "A", "B", "A", "B", "A", "B", "A", "B") data_frame <-data.frame(concentration, area, area_type) 在这个例子中,我想要计算每个area_type级别的浓度和面积之间的关系

How should I format my data for the R mlogit package?

I am using the mlogit package with R. After importing my data using: t <-read.csv('junk.csv',header=TRUE, sep=",", dec=".") and call: x <- mlogit.data(t,choice="D",shape="long",id.var="key",alt.var="altkey") I am getting the following error: Error in `row.names<-.data.frame`(`*tmp*`, value = c("1.1", "1.2", "1.3", : duplicate 'row.names' are not allowed In addition: Warning me

我应该如何格式化R mlogit软件包的数据?

我正在使用R的mlogit软件包。 导入我的数据后使用: t <-read.csv('junk.csv',header=TRUE, sep=",", dec=".") 并致电: x <- mlogit.data(t,choice="D",shape="long",id.var="key",alt.var="altkey") 我收到以下错误: Error in `row.names<-.data.frame`(`*tmp*`, value = c("1.1", "1.2", "1.3", : duplicate 'row.names' are not allowed In addition: Warning message: non-unique values when setting

Using Gradle with R project

I am beginning work on a project that makes heavy use of R. I've used R in the past, but only in a casual mode, whereas I'm now interested in following a more rigid practice of test/source control/continuous integration. I'm hoping to use Gradle with this project if possible, but I can't find any evidence that it is possible to use Gradle with R. Is it possible to create an R pro

使用Gradle和R项目

我正在开始一个大量使用R的项目。我过去使用过R,但只是在休闲模式下工作,而现在我正在考虑遵循更严格的测试/源代码控制/持续集成的实践。 如果可能,我希望在这个项目中使用Gradle,但是我找不到任何证据表明可以使用Gradle和R.可以使用Gradle创建一个R项目,如果可以,我可以在哪里找到帮助我开始的步骤? 似乎有一个第三方插件(https://github.com/jamiefolson/gradle-plugin-r)。 或者,如果R提供了一些命令行工具或A

How to get the time elapsed between two points?

I've tried to use Sys.time to get the time elapsed between two points. However, it doesn't output in a way I like. This is how it looks now: a <- Sys.time ...running stuff between these two points... b <- Sys.time c <- b - a c Time difference of 1.00558 hours I only want the number and the units. I know that to get just the number I can do: c[[1]] However, sometimes the r

如何获得两点之间的时间?

我试图使用Sys.time来获取两点之间的时间。 但是,它不会以我喜欢的方式输出。 这是它现在的样子: a <- Sys.time ...running stuff between these two points... b <- Sys.time c <- b - a c Time difference of 1.00558 hours 我只想要数字和单位。 我知道要获得我可以做的数字: c[[1]] 但是,有时候c的结果可以给我几分钟或几分钟。 我只想要我有数字的情况,以及单位是几小时的情况。 有谁知道一种方式

How do you use multiple versions of the same R package?

In order to be able to compare two versions of a package, I need to able to choose which version of the package that I load. R's package system is set to by default to overwrite existing packages, so that you always have the latest version. How do I override this behaviour? My thoughts so far are: I could get the package sources, edit the descriptions to give different names and build,

你如何使用同一个R包的多个版本?

为了能够比较两个版本的软件包,我需要能够选择我加载的软件包的版本。 R的软件包系统默认设置为覆盖现有软件包,因此您始终拥有最新版本。 我如何覆盖这种行为? 我到目前为止的想法是: 我可以获取软件包源,编辑描述以给出不同的名称,并生成两个不同的软件包。 尽管如此,我宁愿能够直接与二进制文件一起工作,因为它不那么麻烦。 我不一定需要同时加载两个版本的软件包(只需同时安装)。 我可能会用Sys.getenv(&

Sweave can't load R packages

I upgraded R to v2.14.0 and along with the upgrade I decided to move the standard package repository to Dropbox so laptop and desktop are in sync all the time. I set my R_LIBS=/Dropbox/ToolBox/R/packages in .Renviron and when open Rstudio or R.app (mac) I get the following commands: > Sys.getenv("R_LIBS") [1] "/Dropbox/Toolbox/R/packages" > .libPaths() [1] "/Dropbox/Toolbox/R/packages"

Sweave无法加载R软件包

我将R升级到v2.14.0,随着升级,我决定将标准软件包存储库移到Dropbox,这样便携式计算机和桌面计算机始终保持同步。 我把我的R_LIBS=/Dropbox/ToolBox/R/packages在.Renviron当打开Rstudio或R.app(MAC),我得到了下面的命令: > Sys.getenv("R_LIBS") [1] "/Dropbox/Toolbox/R/packages" > .libPaths() [1] "/Dropbox/Toolbox/R/packages" [2] "/Library/Frameworks/R.framework/Versions/2.14/Resources/libra

register PSOCK cluster with foreach

How would I register a PSOCK cluster (created using package Parallel) with foreach ? I'm currently using registerDoSNOW in the doSNOW package to register a snow SOCK cluster. Use registerDoParallel from the doParallel package on the cluster handle. It is essentially the same as registerDoSNOW for socket clusters.

用foreach注册PSOCK群集

我将如何使用foreach注册PSOCK群集(使用软件包Parallel创建)? 我目前使用registerDoSNOW在doSNOW包注册一个snow袜子集群。 使用群集句柄上的doParallel包中的registerDoParallel 。 它与用于套接字集群的registerDoSNOW基本相同。

Preserving indentation in examples section

Roxygen have made my work a lot easier and is in most cases nice and intuitive. One thing that I have never figured out though is how to preserve indentation in @examples sections so that the result of roxygenize("myPackage") containing #' @examples #' sapply(1:10, function(i){ #' x <- rbind(matrix(rnorm(20), 10, 2), #' matrix(rnorm(20), 10, 2) + i) #' myFunc

在示例部分中保留缩进

Roxygen让我的工作变得更加轻松,并且在大多数情况下都很棒,直观。 我从来没想过的一件事是如何在@examples部分保留缩进,以便包含roxygenize("myPackage")的结果 #' @examples #' sapply(1:10, function(i){ #' x <- rbind(matrix(rnorm(20), 10, 2), #' matrix(rnorm(20), 10, 2) + i) #' myFunc(x) #' } 将会 examples{sapply(1:10, function(i){ x <- rbind(matrix(rnorm(20