楼主: oliyiyi
37259 2254

【latex版】水贴   [推广有奖]

lopemann 发表于 2015-6-13 13:59:11 |显示全部楼层
oliyiyi 发表于 2015-6-8 09:13
迷上了R knitr
哈哈我们的Lab都用这个
BTW,edx的确很不错
IMF都在上面开课了...
已有 1 人评分论坛币 收起 理由
oliyiyi + 60 鼓励积极发帖讨论

总评分: 论坛币 + 60   查看全部评分

回复

使用道具 举报

oliyiyi 发表于 2015-6-13 15:00:11 |显示全部楼层
You can make a design matrix X for a two group comparison either using model.matrix or simply with:

X = cbind(rep(1,nx + ny),rep(c(0,1),c(nx, ny)))

For a comparison of two groups, where the first group has nx=5 samples, and the second group has ny=7 samples, what is the element in the 1st row and 1st column of X^T X?
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 15:20:04 |显示全部楼层
Suppose we have an experiment with two species A and B, and two conditions: control and treated.

species <- factor(c("A","A","B","B"))
condition <- factor(c("control","treated","control","treated"))

And we will use a formula of '~ species + condition'.

The model matrix is then:

model.matrix(~ species + condition)
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 15:24:20 |显示全部楼层
Suppose we want to build a contrast of coefficients for the above experimental design.

You can either figure this question out through logic, by looking at the design matrix, or using the contrast() function from the contrast library. The contrast vector is returned as contrast(...)$X.

What should the contrast vector be, for the contrast of (species=B and condition=control) vs (species=A and condition=treatment)? Assume that the beta vector from the model fit by R is: Intercept, speciesB, conditiontreated.
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 16:33:18 |显示全部楼层
Robust linear models
In calculating the solution and its estimated error in the standard linear model, we minimize the squared errors. This involves a sum of squares from all the data points, which means that a few outlier data points can have a large influence on the solution. In addition, the errors are assumed to be have constant variance (called homoskedasticity), which might not always hold true (when this is not true, it is called heteroskedasticity). Methods have been developed therefore to generate more robust solutions, which behave well in the presence of outliers, or when the distributional assumptions are not met. A number of these are mentioned on the robust statistics page on the CRAN website. For more background, there is also a Wikipedia article with references.
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 17:12:31 |显示全部楼层
最近朋友圈动态:随便走了几步就在运动排行榜排了第一。买我面膜茶叶洗衣粉的太多了,累死了。点一下抢打车的红包,一分钱也是爱啊。哈佛耶鲁微软题目看你能做对几道,做对有个卵用?能帮我孩子投一票吗?能帮我朋友投一票吗?能帮我们企业投一票吗?投你个鬼啊,你反手能摸到你自己的肚脐眼吗?
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 17:14:04 |显示全部楼层
一个同学的状态:前两天吃东西吃坏肚纸了,菊部地区有雷阵雨。
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 17:14:52 |显示全部楼层
Generalized linear models
In the standard linear model, we did not make any assumptions about the distribution of Y, though in some cases we can gain better estimates if we know that Y is, for example restricted to non-negative integers 0,1,2,…, or restricted to the interval [0,1]. A framework for analyzing such cases is referred to as generalized linear models, commonly abbreviated as GLMs. The two key components of the GLM are the link function and a probability distribution. The link function g connects our familiar matrix product Xβ to the Y values through:

E(Y)=g−1(Xβ)
There is a function in base R for fitting GLMs, which is glm and uses a familiar form as lm, with additional arguments including family which specifies the distributional assumption of Y. Some examples of the use of GLMs are shown at the Quick R website. There are a number of references for GLMs on the Wikipedia page.
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 17:19:03 |显示全部楼层
Mixed effects linear models
In the standard linear model, we assumed that the matrix X was fixed and not random. For example, we measured the frictional coefficients for each leg pair, and in the push and pull direction. The fact that an observation had a 1 for a given column in X was not random, but dictated by the experimental design. However, in the father and son heights example, we did not fix the values of the father’s heights, but observed these (and likely these were measured with some error). A framework for studying the effect of the randomness for various columns in X is referred to as mixed effects models, which implies that some effects are fixed and some effects are random. One of the most popular packages in R for fitting linear mixed effects models is lme4 which has an accompanying paper on Fitting Linear Mixed-Effects Models using lme4. There is also a Wikipedia page with more references.
回复

使用道具 举报

oliyiyi 发表于 2015-6-13 17:20:29 |显示全部楼层
Bayesian linear models
The approach presented here focused the estimation of β which minimized the squared error and then calculating its standard error. An alternative approach to the statistical inference about β is using Bayesian methods. Bayesian methods first involve the formulation of prior distributional beliefs about model parameters, and then calculating either directly or computing using computational methods the posterior distribution of β, from which we can examine the posterior mode (the most likely value), and credible intervals. In addition, many models can be connected together in what is referred to as a hierarchical model. A good reference for Bayesian hierarchical models is Bayesian Data Analysis, and some software for computing Bayesian linear models can be found on the Bayes page on CRAN. Some well known software for computing Bayesian models are stan and BUGS.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 我要注册

GMT+8, 2018-11-14 17:28