找回密码
 注册
查看: 394|回复: 0

R语言 SparseM包 slm()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 12:33:07 | 显示全部楼层 |阅读模式
slm(SparseM)
slm()所属R语言包:SparseM

                                        Fit a linear regression model using sparse matrix algebra
                                         适合使用稀疏矩阵代数的线性回归模型

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

This is a function to illustrate the use of sparse linear algebra to solve a linear least squares problem using Cholesky decomposition. The syntax and output attempt to emulate lm() but may fail to do so fully satisfactorily.  Ideally, this would eventually become a method for lm.  The main obstacle to this step is that it would be necessary to have a model.matrix function that returned an object in sparse csr form.  For the present, the objects represented in the formula must be in dense form.  If the user wishes to specify fitting with a design matrix that is already in sparse form, then the lower level function slm.fit() should be used.
这是一个函数,来说明使用的稀疏线性代数求解线性最小二乘问题的使用Cholesky分解。的语法和输出效仿lm()但可能会失败,这样做完全令人满意。在理想的情况下,这最终将成为一个方法lm。此步骤中的主要障碍是有model.matrix函数,该函数返回一个对象在稀疏csr的形式,这将是必要的。就目前来说,在式表示的对象必须是在密集的形式。如果用户希望指定与设计矩阵,它是已经在稀疏的形式,然后较低水平功能slm.fit()应使用的嵌合。


用法----------Usage----------


slm(formula, data, weights, na.action, method = "csr", contrasts = NULL, ...)



参数----------Arguments----------

参数:formula
a formula object, with the response on the left of a ~ operator, and the terms, separated by + operators, on the right.  As in lm(), the response variable in the formula can be matrix valued.  
一个公式对象,在左边的一个~运营商,及条款,分离+运营商,在右边的响应。在lm(),响应公式中的变量可以是矩阵值。


参数:data
a data.frame in which to interpret the variables named in the formula, or in the subset and the weights argument. If this is missing, then the variables in the formula should be on the search list.  This may also be a single number to handle some special cases – see below for details.  
命名为式中的解释变量,在其中,或者在子集和的权重参数的数据框。如果没有这个,然后在公式中的变量应该是在搜索列表中。这也可能是一个单一的数字处理一些特殊的情况下 - 见下文的详细信息。


参数:weights
vector of observation weights; if supplied, the algorithm fits to minimize the sum of the weights multiplied into the absolute residuals. The length of weights must be the same as the number of observations.  The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous.  
观察权重向量,如果提供的话,该算法适合于最小化的权重的总和乘以成绝对残差。作为观测值的数量,权重的长度必须是相同的。权重必须是非负的,强烈建议严格,他们是积极的,因为零的权重是不明确的。


参数:na.action
a function to filter missing data. This is applied to the model.frame after any subset argument has been used. The default (with na.fail) is to create an error if any missing  values are found.  A possible alternative is na.omit, which deletes observations that contain one or more missing values.  
一个函数来筛选丢失的数据。这是适用于model.frame后的任意子集的参数是否被使用。默认值(用na.fail)是创建一个错误,如果发现任何遗漏值的。一个可能的选择是na.omit,这将删除包含一个或多个缺失值的观察,。


参数:method
there is only one method based on Cholesky factorization
基于Cholesky分解的方法只有一个


参数:contrasts
a list giving contrasts for some or all of the factors default = NULL appearing in the model formula. The elements of the list should have the same name as the variable and should be either a contrast matrix (specifically, any full-rank matrix with as many rows as there are levels in the factor), or else a function to compute such a matrix given the number of levels.  
的某些或所有的因素默认的列表给反差=NULL中出现的模型公式。元素的列表中应具有相同的名称的变量,并应该是对比度基质(具体地,任何与尽可能多的行满秩矩阵因子有水平),否则一个函数来计算这样一个矩阵给定的级别数。


参数:...
additional arguments for the fitting routines  
额外的参数拟合程序


值----------Value----------

A list of class slm consisting of:
列表类slm组成的:


参数:coefficients
estimated coefficients
估计系数


参数:chol
cholesky object from fitting
乔里斯基对象从配件


参数:residuals
residuals
残差


参数:fitted
fitted values
拟合值


参数:terms
terms
条款


参数:call
call
呼叫

...
...


(作者)----------Author(s)----------


Roger Koenker



参考文献----------References----------

http://www.econ.uiuc.edu/~roger/research

参见----------See Also----------

slm.methods for methods summary, print, fitted, residuals and coef associated with class slm, and slm.fit for lower level fitting functions.  The latter functions are of special interest if you would like to pass a sparse form of the
slm.methods方法summary,print,fitted,residuals和coef与slm级和slm.fit 较低水平的拟合函数。后者的功能是特别感兴趣,如果你想通过一个稀疏形式的


实例----------Examples----------


data(lsq)
X <- model.matrix(lsq) #extract the design matrix[提取的设计矩阵]
y <- model.response(lsq) # extract the rhs[提取的RHS]
X1 <- as.matrix(X)
slm.time &lt;- unix.time(slm(y~X1-1) -&gt; slm.o) # pretty fast[蛮快的]
lm.time &lt;- unix.time(lm(y~X1-1) -&gt; lm.o) # very slow[很慢]
cat("slm time =",slm.time,"\n")
cat("slm Results: Reported Coefficients Truncated to 5  ","\n")
sum.slm <- summary(slm.o)
sum.slm$coef <- sum.slm$coef[1:5,]
sum.slm
cat("lm time =",lm.time,"\n")
cat("lm Results: Reported Coefficients Truncated to 5  ","\n")
sum.lm <- summary(lm.o)
sum.lm$coef <- sum.lm$coef[1:5,]
sum.lm

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-10 02:43 , Processed in 0.052859 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表