Displaying 20 results from an estimated 6000 matches similar to: "how to write text into a file"
2009 Feb 28
3
Extract statistics from lm()
Hi, perhaps this question was answered previously however I could not find
them. My problem is how how to extract a particular statistic from the
result given by lm(). For e.g.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
>
2005 Feb 17
2
dumping the summary of lm to a text file
Hello list,
I have a linear regression
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
reg <- lm(weight ~ group)
sreg <- summary(reg)
and I would like to dump exactly what I see on the console with
2006 Nov 09
1
Extracting the full coefficient matrix from a gls summary?
Hi,
I am trying to extract the coefficients matrix from a gls summary.
Contrary to the lm function, the command fit$coefficients returns
only the estimates of the model, not the whole matrix including the
std errors, the t and the p values.
example:
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <-
2010 Aug 12
3
Median abline how-to ?
Hi,
I'm newbie with R and don't really know how to add a median line to each
of the groups that is not all the plot long.
Here is a small working code that i have adapted for my purpose. If
somebody could tell me how to draw median lines on each group and not
all plot long.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <-
2008 Sep 26
2
ANOVA between & within variance
hi,
is there an option to calculate the 'within' & 'between' group variances
for a simple ANOVA (aov) model (2 groups, 1 trait, normally distr.) ?
or do I have to calculate them from the Sum Sq ?
thanks for your time and greetings,
gregor
--
Gregor Rolshausen
PhD Student; University of Freiburg, Germany
e-mail: gregor.rolshausen at biologie.uni-freiburg.de
tel. :
2008 Jul 16
1
Output design question
Dear R-helpers,
I was curious why the output of summary (and many other functions in
R) does not add a separator between the name of a factor and the label
of a level (e.g., in the example below, 'group Trt'). If the user had
lower case labels (e.g., 'trt'), the output would be particularly hard
to read.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt
2005 Sep 29
5
Regression slope confidence interval
Hi list,
is there any direct way to obtain confidence intervals for the regression
slope from lm, predict.lm or the like?
(If not, is there any reason? This is also missing in some other statistics
softwares, and I thought this would be quite a standard application.)
I know that it's easy to implement but it's for
explanation to people who faint if they have to do their own
programming...
2007 Nov 26
1
pass lm( ) a char vector as the variables to be included
Dear Everyone in list:
I am writing some codes to automate the process of
fitting linear models where the names of variables of
models are produced and stored in character vectors.
But I have problems to pass the vectors to the lm( )
because I don't know how to strip the quotation marks
automatically.
Here are the codes of the example of lm( ):
## Annette Dobson (1990) "An Introduction
2009 Sep 03
1
Export objects
<r-help@r-project.org>
Hi, R users,
How can I export an R object as a .txt file? As an example I have the result
from a regression and I need to save this object in a .txt file
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl,
2024 Dec 23
1
Calculation of critical probability from lm()
Hi,
I tried to replicate the values of critical probabilities reported
from lm() function in R as below
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
model_coed <- summary(lm(weight ~ group))[[4]]
print(pt(abs(model_coed[,
2011 Jul 11
2
lm: mark sample used in estimation
Hi all,
I wanted to mark the estimation sample: mark what rows (observations)
are deleted by lm due to missingness. For eg, from the original
example in help, I have changed one of the values in trt to be NA
(missing).
# code below
# ----
# original example
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
#
2005 Jul 28
1
Displaying p-values in latex
Hi. I want to create a table in latex with regression coefficients and their
corresponding p-values. My code is below. How do I format the p-values so
that values less than 0.0001 are formated as <.0001 rather than just rounded
to 0.0000? Thank you.
model<-lm(y~x1+x2)
output<-summary(model)
output<-as.matrix(coefficients(output))
output<-format.df(ouput,cdec=c(2,2,2,4))
2005 Dec 20
1
Linux command
I wonder if it's possible to run R-functions or other commands
automatically by some shell-script in Linux shell.
I thought that something like
$ R mean(c(1,2))
$ R xy.Rdata
would work, but I havent found the right way.
2006 May 16
1
lm summary
Dear all,
Is there anybody who can help me to avoid scientific number in the summary of an lm model?
Here there is an example of a usual output of the lm model.
Thank you!
Guillermo
Example
summary(lm(promiscuity.Index~allK))
Call:
lm(formula = promiscuity.Index ~ allK)
Residuals:
Min 1Q Median 3Q Max
-1.67094 -0.13126 0.06703 0.19913 0.40673
Coefficients:
2008 Dec 23
1
sorting regression coefficients by p-value
Hi,
Is there a way to get/extract a matrix of regression variable name, coefficient, and p values?
(for lm and glm; which can be sort by p value?)
thanks
Dhruv
[[alternative HTML version deleted]]
2009 Dec 14
2
R2 in lm function
Hi All,
After I run the lm function, where (which variable) do I find my R-squared
for further calculations?
Thanks,
Tom
--
View this message in context: http://n4.nabble.com/R2-in-lm-function-tp963958p963958.html
Sent from the R help mailing list archive at Nabble.com.
2013 Feb 19
1
Small quirks in summary.(g)lm docs
Hi!
In R 3.0.0 from current SVN, ?summary.lm says:
> Value [...]
> df degrees of freedom, a 3-vector (p, n-p, p*), the last
> being the number of non-aliased coefficients.
?summary.glm says:
> df a 3-vector of the rank of the model and the number of residual
> degrees of freedom, plus number of non-aliased coefficients.
It seems to me that the description is reversed: p is
2003 Aug 14
2
How to get the pseudo left inverse of a singular square matrix?
Dear R-listers,
I have a dxr matrix Z, where d > r.
And the product Z*Z' is a singular square matrix.
The problem is how to get the left inverse U of this
singular matrix Z*Z', such that
U*(Z*Z') = I?
Is there any to figure it out using matrix decomposition method?
Thanks a lot for your help.
Fred
2008 Jul 25
2
graphing regression coefficients and standard errors
Hello,
I am interested in plotting my regression analysis
results(regression coefficients and standard errors obtained through OLS and
Tobit models)
in the form of graphs.What is the best way to accomplish this? Thanks.
Murali Kuchibhotla
[[alternative HTML version deleted]]
2008 Apr 25
2
Extracting coefficients' standard errors from linear model
Dear all,
Hope this question is not too trivial...
In order to correct standard errors from an estimation of a fixed
effects regression model y need to extract the vector of standard errors
of the coefficients of a simple linear model estimated using
lm(var1~var2+var3+var4)
Unfortunately I can't find out the corresponding function.
Thank you very much for your help.
Uli
--
Uli