Displaying 20 results from an estimated 1000 matches similar to: "Linear Regression Problem"
2008 Jun 30
2
difference between MASS::polr() and Design::lrm()
Dear all,
It appears that MASS::polr() and Design::lrm() return the same point
estimates but different st.errs when fitting proportional odds models,
grade<-c(4,4,2,4,3,2,3,1,3,3,2,2,3,3,2,4,2,4,5,2,1,4,1,2,5,3,4,2,2,1)
score<-c(525,533,545,582,581,576,572,609,559,543,576,525,574,582,574,471,595,
557,557,584,599,517,649,584,463,591,488,563,553,549)
library(MASS)
library(Design)
2009 Nov 02
3
partial matching with grep()
dear all,
This is a probably a silly question.
If I type
> grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE)
[1] "a.x" "b.x" "a.xx"
Instead, I would like to obtain only
"a.x" "b.x"
How is it possible to get this result with grep()?
many thanks for your attention,
best,
vito
--
2006 Feb 27
3
how to use the basis matrix of "ns" in R? really confused by multi-dim spline filtering?
Hi all,
Could anybody recommend some easy-to-understand and example based
notes/tutorials on how to use cubic splines to do filtering on
multi-dimension data?
I am confused by the 1-dimensional case, and more confused by
multi-dimensional case.
I found all the books suddenly become very abstract when it comes to this
subject.
They don't provide examples in R or Splus at all.
Specifically,
2008 May 02
1
error in using by + median
dear all,
Could anyone explain me the behaviour of median() within by()?
(I am running R.2.7.0)
thanks,
vito
> H<-cbind(rep(0:1,l=20),matrix(rnorm(20*2),20,2))
> by(H[,-1],H[,1],mean)
INDICES: 0
V1 V2
-0.2101069 0.2954377
---------------------------------------------------------------------------------------------------------------------
INDICES: 1
V1
2006 Nov 03
1
difference in using with() and the "data" argument in glm call
Dear all,
I am dealing with the following (apparently simple problem):
For some reasons I am interested in passing variables from a dataframe
to a specific environment, and in fitting a standard glm:
dati<-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
KK<-new.env()
for(i in 1:ncol(dati)) assign(names(dati[i]),dati[[i]],envir=KK)
#Now the following two lines work correctly:
2009 Jun 15
1
Linear Models: Explanatory variables with uncertainties
One of the assumptions, on which the (General) Linear Modelling is
based is that the response variable is measured with some
uncertainties (or weighted), but the explanatory variables are fixed.
Is it possible to extend the model by assigning the weights to the
explanatory variables as well? Is there a package for doing such a
model fit?
Thanks
2009 Jun 23
1
gradually switching regression
Hello,
I'm trying to find an algorithm to estimate a switching regression model
based on the 1990 Economics Letters paper by Ohtani/Kakimoto/Abe or the
earlier version from 1985 (Ohtani/Katayama, Economic Studies Quarterly;
assuming as a transition path a polynomial of order 1).
I found an idea for using nls here:
http://www.biostat.wustl.edu/archives/html/s-news/2000-04/msg00223.html.
2009 Oct 15
2
Estimation in a changepoint regression with R
Dear All,
I'm trying to do the estimation in a changepoint regression problem via R, but never found any suitable function which might help me to do this.
Could someone give me a hand?on this matter?
Thank you.
2009 Feb 10
1
harmonic function fiting? how to do
Dear R Users,
I have a CO2 time series. I want to fit this series seasonal cycle and trend
with fourth harmonic function,
and then compute residuals.
I am doing something like:
file<-read.csv("co2data.csv")
names(file)
attach(file)
fit<-lm(co2~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+
2010 Mar 04
1
only actual variable names in all.names()
dear all,
When I use all.vars(), I am interest in extracting only the variable names..
Here a simple example
all.vars(as.formula(y~poly(x,k)+z))
returns
[1] "y" "x" "k" "z"
and I would like to obtain
"y" "x" "z"
Where is the trick?
many thanks
vito
--
====================================
Vito M.R. Muggeo
Dip.to Sc
2010 Oct 25
1
building lme call via call()
dear all,
I would like to get the lme call without fitting the relevant model.
library(nlme)
data(Orthodont)
fm1 <- lme(distance ~ age, random=list(Subject=~age),data = Orthodont)
To get fm1$call without fitting the model I use call():
my.cc<-call("lme.formula", fixed= distance ~ age, random = list(Subject
= ~age))
However the two calls are not the same (apart from the data
2007 Nov 28
3
using names with functions..
Dear all,
I have the following (rather) strange problem..
For some reasons, I finally work with a variable whose name includes an
R function, "a.log(z)", say. And that is a problem when I call it in a
formula, for instance:
> myname<-"a.log(z)"
> dd<-data.frame("a.log(z)"=1:10,y=rnorm(10))
> o<-lm(y~1,data=dd)
>
2008 Oct 03
1
NA's in segmented
I am trying to fit a very simple broken stick model using the package
"segmented" but I have hit a roadblock.
> str(data)
'data.frame': 18 obs. of 2 variables:
$ Bin : num 0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75 ...
$ LnFREQ: num 5.06 4.23 3.50 3.47 2.83 ...
I fit the lm easily:
> fit.lm<-lm(LnFREQ~Bin, data=id07)
But I keep getting an error
2009 Feb 09
2
R equivalent of SAS Cochran-Mantel-Haenszel tests?
In SAS, for a two-way (or 3-way, stratified) table, the CMH option in
SAS PROC FREQ gives
3 tests that take ordinality of the factors into account, for both
variables, just the column variable
or neither. Is there an equivalent in R?
The mantelhaen.test in stats gives something quite different (a test of
conditional independence for
*nominal* factors in a 3-way table).
e.g. I'd like to
2009 Sep 08
2
Fitting a linear model with a break point
Hello,
I would like to test some data to see whether it has the shape of a step
function (i.e. y1 up until x_th and then y2 where x_th is the
threshold). The threshold x_th is unknown and the x values can only
take discrete values (0,1,2,3,4).
An example would be:
data<- data.frame(x=1:20,y=c(rnorm(10),rnorm(10,10)))
I was thinking along the lines of fitting some sort of piiecewise linear
2011 Jan 18
2
Convert a matrix's columns to list
Dear R,
Is there an efficient way to make a list that each element is from the
corresponding column of a matrix. For example, if I have a matrix "a"
> a <- matrix(1:10, 5, 2)
> a
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
I would like to have a list "b" like this
> b <- list(a[, 1], a[, 2])
> b
[[1]]
[1] 1 2 3
2011 Jan 18
1
Choosing statistical test - Fisher's Exact Test?
Hi I was wondering whether anyone can help me with this problem....it's been
driving me nuts, I've been trying to figure it out for months and months
without success!! Basically I have a group of participants who attended 2
experimental sessions a few months apart. I took measures of the way they
approach two tasks at Time 1 and the same two tasks at Time 2. I have
categorical data (a
2011 Jan 28
1
plot not generic
Hello list.
I was trying to see some of the code for plot.glmnet in package glmnet (this
function name is in the documentation).
After loading the library, I tried the obvious typing in the name, but I
received a message telling me it could not be found.
So I fiddled around a little, and noticed that R does not recognize ''plot''
as a generic function, and as such,
2007 Dec 06
2
Segmented regression
Hello all,
I have 3 time series (tt) that I've fitted segmented regression models
to, with 3 breakpoints that are common to all, using code below
(requires segmented package). However I wish to specifiy a zero
coefficient, a priori, for the last segment of the KW series (green)
only. Is this possible to do with segmented? If not, could someone point
in a direction?
The final goal is to
2010 Nov 30
1
confidence interval for logistic joinpoint regression from package ljr
I?m trying to run a logistic joinpoint regression utilising the ljr package. I?ve been using the forward selection technique to get the number of knots for the analysis, but I?m uncertain as to my results and the interpretation. The documentation is rather brief ( in the package and the stats in medicine article is quite technical) and without any good examples. At the moment I?m thinking
1)find