R中的波浪线Tilde_in_R

这篇具有很好参考价值的文章主要介绍了R中的波浪线Tilde_in_R。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Tilde in R ~

Tilde symbol l is used within formulas of statistical models, as mainly this symbol is used to define the relationship between the dependent variable and the independent variables in the statistical model formula in the R programming language. The left side of the tilde symbol specifies the target variable (dependent variable or outcome) and the right side of the tilde specifies the predictor variable(independent variables). (Source: https://www.geeksforgeeks.org/use-of-tilde-in-r/)

Below source: https://bookdown.org/danieljcarter/r4steph/two-sample-t-test.html

Two-sample t-test

We can also conduct a two-sample t-test to determine if the mean population birthweight in boys is the same as the mean population birthweight in girls. The syntax here is slightly different as it uses R’s formula interface. A formula is indicated by the presence of a tilde (~), and the tilde is shorthand for ‘estimate’. So the formula in the code chunk below says: estimate birthweight from sex. This is slightly counter-intuitive for the t-test but will make more sense when applied more generally under a regression framework later on.

We use the var.test() command to conduct an F test to assess whether the equality of variance assumption holds.


```r
#--- Run the two-sample t-test
bab9 %$% t.test(bweight ~ sex, var.equal = T)

## 
##  Two Sample t-test
## 
## data:  bweight by sex
## t = 3, df = 600, p-value = 0.001
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   66.6 267.7
## sample estimates:
##   mean in group male mean in group female 
##                 3211                 3044

Bonferroni correction for multiple tests

Source: https://book.phylolab.net/binf8441/lab7.html
R中的波浪线Tilde_in_R,r语言,开发语言


```r
numtest = 4
pvalue = 1:numtest
for(i in 1:numtest){
    pvalue[i] = t.test(data[,i+1] ~ data[,1])$p.value
}

print("the Bonferroni adjusted pvalues")
pvalue*numtest

We estimate the four columns based on the first column, 0 or 1 group. 是按照第一列分成的两组。文章来源地址https://www.toymoban.com/news/detail-835997.html

> t.test(data[,i+1] ~ data[,1])

	Welch Two Sample t-test

data:  data[, i + 1] by data[, 1]
t = -2.9682, df = 17.128, p-value = 0.008566
alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
95 percent confidence interval:
 -2.6167353 -0.4430667
sample estimates:
mean in group 0 mean in group 1 
      0.3970631       1.9269641 
      

到了这里,关于R中的波浪线Tilde_in_R的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 以太坊智能合约开发:Solidity 语言中的数据类型

    本文我们介绍Solidity语言的数据类型,重点是值类型,包括布尔类型、整型、地址类型、字节类型、字符串类型和枚举类型。并且通过两个智能合约例子,用于演示这些数据类型的声明与使用方法。 访问 Github 仓库 获取更多资料。 Solidity中关于数据类型的定义如下: Solidity是

    2024年02月02日
    浏览(56)
  • 鸿蒙开发:深入了解Arkts语言中的Want对象及其运用

    Arkts语言中的 Want 是一种用于对象间信息传递的载体,主要用于应用组件之间的信息传递。本文将深入探讨 Want 的定义、用途、类型以及参数说明

    2024年02月04日
    浏览(38)
  • [开发语言][python][c++]:C++中的this指针和Python中的Self -- 26岁生日

    以朋友的新岁祝福开篇,祝笔者也祝大家☺️: 之前一直对 C++ 中的 this 和 python 中的 self 到底是什么关系,为什么 C++ 要显式的写出来,python 则不需要? 模糊不清,趁着周末整理一下相关结论,希望本篇文章可以解答这些问题,同时对C++和Python中的类加深些理解。 python 当

    2024年01月24日
    浏览(54)
  • 鸿蒙开发:深入了解Arkts语言中的Want对象及其运用【鸿蒙专栏-23】

    Arkts语言中的 Want 是一种用于对象间信息传递的载体,主要用于应用组件之间的信息传递。本文将深入探讨 Want 的定义、用途、类型以及参数说明

    2024年02月05日
    浏览(38)
  • 【MySql】RR 与 RC的本质区别

    本篇博客介绍的是RR与RC的本质区别,话不读说,直接进入主题即可。 select * from user lock in share mode ,以加共享锁方式进行读取,对应的就是 当前读 不加lock in share mode就是 快照读 设置隔离级别RR 首先设置隔离级别RR : 设置完毕之后要进行重启终端才会生效。 现在创建一张表

    2024年02月11日
    浏览(23)
  • 网络安全|渗透测试入门学习,从零基础入门到精通—渗透中的开发语言

    目录 前面的话 开发语言 1、html 解析 2、JavaScript 用法 3、JAVA   特性 4、PHP 作用 PHP 能做什么? 5、C/C++ 使用 如何学习 关于在渗透中需要学习的语言第一点个人认为就是可以打一下HTML,JS那些基础知识,磨刀不误砍柴工。其次,了解基本的代码后,就可以去学习相关的漏洞知

    2024年02月09日
    浏览(39)
  • [开发语言][c++][python]:C++与Python中的赋值、浅拷贝与深拷贝

    写在前面 :Python和C++中的赋值与深浅拷贝,由于其各自语言特性的问题,在概念和实现上稍微有点差异,本文将这C++和Python中的拷贝与赋值放到一起,希望通过对比学习两语言实现上的异同点,加深对概念的理解。 C++中所谓的 浅拷贝 就是由(系统默认的) 拷贝构造函数对

    2024年02月02日
    浏览(39)
  • 【HCIE】 跨域MPLS-VPN OptionC (RR) 方式一

    实验目标: R9的环回口的私网地址192.168.9.9 能ping通R10的环回口私网地址192.168.10.10 且为最优路径。 接口地址说明: R1: 注意:R1的g0/0/1地址是绑定vpn实例后的地址。绑定实例会清空原有接口地址,需先用命令dis this 查看。每年IE考试都有同学在这个地方挂掉。 R2: R3: R4: R

    2024年02月13日
    浏览(26)
  • 三种常用的流行病学指标:RR、AR和OR

      当我们研究某种疾病或健康问题时,我们需要了解不同人群之间的风险差异。为了衡量这种风险差异,流行病学家们使用了许多不同的指标,其中最常用的包括相对风险( R R RR RR )、绝对风险( A R AR A R )和比值比( O R OR OR )。 相对风险( R R RR RR ) 是指患病率或死

    2024年02月12日
    浏览(17)
  • IPVS: rr: TCP xxxxxX - no destination available 问题优化

    可以参考腾讯的 sysctl参数控制输出 参考 :https://github.com/Tencent/TencentOS-kernel/commit/fe66d659f44e13c0e1c007782309d79c987b4788

    2024年02月12日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包