Displaying 20 results from an estimated 600 matches similar to: "How to show variables used in lm function call?"
2009 Feb 07
3
Output results to a single postscript document
Hello R users,
I have been trying to output all my results (text, plots, etc) into the same
postscript file as
one document, but have been unable to...Can anyone help me improve my code
below so that I can
accomplish this? Currently I have to output them separately then piece them
back together into
one document..
Thanks in Advance for any help!
options (scipen=999, digits=7)
2008 May 22
1
How to account for autoregressive terms?
Hi,
how to estimate a the following model in R:
y(t)=beta0+beta1*x1(t)+beta2*x2(t)+...+beta5*x5(t)+beta6*y(t-1)+beta7*y(t-2)+beta8*y(t-3)
1) using "lm" :
dates <- as.Date(data.df[,1])
selection<-which(dates>=as.Date("1986-1-1") & dates<=as.Date("2007-12-31"))
dep <- ts(data.df[selection,c("dep")])
indep.ret1
2013 Mar 21
4
easy way of paste
Hello,
Is there a better way to use paste such as:
a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.indep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep="+")
> a
[1] "aa+dummy1+dummy2+bb+cc"
I tried
a = paste(colnames(list.indep)[1:5],sep="+")
> a
[1] "aa" "dummy1" "dummy2"
2012 Sep 29
1
Unexpected behavior with weights in binomial glm()
Hi useRs,
I'm experiencing something quite weird with glm() and weights, and
maybe someone can explain what I'm doing wrong. I have a dataset
where each row represents a single case, and I run
glm(...,family="binomial") and get my coefficients. However, some of
my cases have the exact same values for predictor variables, so I
should be able to aggregate up my data frame and
2012 Jan 15
1
Need help interpreting the logit regression function
Hello R community,
I have a question about the logistic regression function.
Specifically, when the predictor variable has not just 0's and 1's,
but also fractional values (between zero and one). I get a warning
when I use the "glm(formula = ... , family = binomial(link =
"logit"))" which says:
"In eval(expr, envir, enclos) : non-integer #successes in a binomial
2009 Jun 21
2
Help on qpcR package
I am using R on a Windows XP professional platform.
The following code is part of a bigger one
CODE
press=function(y,x){
library(qpcR)
models.press=numeric(0)
cat("\n")
dep=y
print(dep)
indep=log(x)
print(indep)
yfit=dep-PRESS(lm(dep~indep))[[2]]
cat("\n yfit\n")
print(yfit)
yfit.orig=yfit
presid=y-yfit.orig
press=sum(presid^2)
2010 Mar 16
3
function arguments: name of an object vs. call producing the object?
In a function, say foo.glm for glm objects I want to use the name of the
object as a label for some output,
but *only* if a glm object was passed as an argument, not a call to
glm() producing that object.
How can I distinguish these two cases?
For example, I can use the following to get the name of the argument:
foo.glm <- function(object) {
oname <- as.character(sys.call())[2]
2005 Mar 30
2
Step error
Could anyone tell me what am I doing wrong?
> pro<-function(indep,dep){
+ d<-data.frame(indep)
+ form<-formula(lm(dep~.,data=d))
+
forward<-step(lm(dep~X1,data=d),scope=form,trace=0,direction='f')
+ return(forward)
+ }
> pro(m,q)
Error in inherits(x, "data.frame") : Object "d" not
found
Where q is a vector with the dependent variable's
2008 Sep 03
1
test if all predictors in a glm object are factors
I'm trying to develop some graphic methods for glm objects, but they
only apply for models
where all predictors are discrete factors. How can I test for this in a
function, given the
glm model object?
That is, I want something that will serve as an equivalent of
is.discrete.glm() in the following
context:
myplot.glm <-
function(model, ...) {
if (!inherits(model,"glm"))
2004 Oct 07
5
'with' usage question
Default arguments are evaluated in the function frame, not in the calling
environment (nor in the same place as explicit arguments).
> Which to me reads that a with statement as above is equivalent to
>
> > attach(data) ; aov.SS1(y=Obs) ; detach(data)
>
> Or is that just wishful thinking??
The latter.
On Thu, 7 Oct 2004, RenE J.V. Bertin wrote:
> Hello,
>
>
2000 Mar 31
1
R: one bananna aov() question
Hello world,
I'm trying to do an
anova on data in data.set, dependent variable is a column
named "dep.var", grouping variable is in a column called "indep.var", and
is.factor(indep.var) is TRUE...
why can't I just do aov(dep.var ~ indep.var, data = data.set)?
What have I done to deserve this?! What gives? Am I missing something
totlly obvious?
R-base-1.0.0-1,
2003 Aug 21
4
anova(lme object)
Hi,
I use lme to fit models like
R> res1 <- lme(y~A+B, data=mydata, random=~1|subject)
R> res2 <- lme(y~B+A, data=mydata, random=~1|subject)
(only difference between these two models are the
sequence in which the indep variables are written in
formula)
where y is continuous and A, B, and subject are
factors. To get ANOVA table I used
R> anova(res1)
R> anova(res2)
and found
2010 Oct 19
2
Strange glm(, quasipoisson) error
Dear list,
I have recently encountered an odd error when running glm(dep~indep,
quasipoisson): while, with a subset of my data, I could get a
perfectly reasonable model, once I include all of my data (17K+
observations, 29 variables), I get the following error:
Error in if (any(y < 0)) stop("negative values not allowed for the
quasiPoisson family") :
missing value where
2009 Jan 20
1
generalizing expand.table: table -> data.frame
In
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3064.html
a method was given for converting a frequency table to an expanded data
frame representing each
observation as a set of factors. A slightly modified version was later
included in the NCStats package,
only on http://rforge.net/ (and it has too many dependencies to be useful).
I've tried to make it more general, allowing an input
2005 Jun 17
0
another aov results interpretation question
I commend you to (a) the recent article by Doug Bates on "Fitting
nonlinear mixed models in R" pp. 27-30 in the latest issue of "R News"
available from "www.r-project.org" -> Newsletter and (b) Doug's book
with Pinheiro (2000) Mixed-Effects Models in S and S-PLUS (Springer). I
suggest you try the same analysis using in "lmer", library(lme4), and
2005 Apr 25
2
[LLVMdev] can bc/asm carry enough type info for C/C++ compiler/interpreter?
I am asking this question to see if it is possible or desirable to build a compilation/runtime system for C/C++ that can support the following:
1. allow bc to call native (in dynamically loaded *.so)
2. allow native to call bc (through JIT or interpreter)
3. can compile/interpret C/C++ sources _BASED_ on type info in precompiled bc
Motivation:
The class files produced by the java compiler
2008 May 29
2
In fact this is a Stats question, but...
Dear All,
I'me having (much) trouble understanding why it happened and answering
a referee's comment to part of a submitted manuscript. I've tried to
google for help but... I'm really confident that although this is a
R-Help list someone can help me!
I used R to do an ANCOVA w/ RNA/DNA as the dep var, sl as the indep
var and gut (a factor w/ levels: prey and empty) as the
2011 Mar 15
1
sample size of 2 groups of skewed data
Hi all:
I have a question on sample size calculation of 2 groups of data. If 2
groups of data are all normal distribution, then I can use the function
"n.indep.t.test.eq" from samplesize package.But if 2 groups of data are all
skewed distribution, but not normal distribution,how can I calculate the
sample size then?
I've tried many transformation (e.g. log arcsin…) in order to
2010 Aug 17
2
Independent variables omitted in lm and glm
Dear List,
Some independent variable were missing in calculation using lm and glm
(gaussian).
(X= Y1+Y2+…..+Y16, Independent number: 16 variable)
However, those variables did work well in cor(X, Y) respectively.
str(dataframe) was also run to ensure that the variables were all numbers.
Moreover, the missing variables were different in lm and glm.
In lm, 3 factors were not taken into
2005 Apr 25
0
[LLVMdev] can bc/asm carry enough type info for C/C++ compiler/interpreter?
On Mon, Apr 25, 2005 at 04:34:07AM -0500, Zeyu Chen wrote:
> I am asking this question to see if it is possible or desirable to
> build a compilation/runtime system for C/C++ that can support the
> following:
>
> 1. allow bc to call native (in dynamically loaded *.so)
You can do this today, e.g., with lli -load=native.so file.bc
> 2. allow native to call bc (through JIT or