Displaying 20 results from an estimated 10000 matches similar to: "Intercepts in linear models."
2007 Oct 03
3
Factor levels.
I have factors with levels ``Unit", "Achieved", and "Scholarship"; I
wish to replace these with
"U", "A", and "S".
So I do
fff <- factor(fff,labels=c("U","A","S"))
This works as long as all of the levels are actually present in the
factor. But if ``Scholarship'' is absent
(as if often is) then
2012 Oct 05
1
Format of numbers in plotmath expressions.
I want to do something like:
TH <- sprintf("%1.1f",c(0.3,0.5,0.7,0.9,1))
plot(1:10)
legend("bottomright",pch=1:5,legend=parse(text=paste("theta ==",TH)))
Notice that the final "1" comes out in the legend as just plain "1" and NOT
as "1.0" although TH is
[1] "0.3" "0.5" "0.7" "0.9"
2008 Feb 20
2
Data frame with 0 rows.
For reasons best known only to myself ( :-) ) I wish to create a data
frame with 0 rows and 9 columns.
The best I've been able to come up with is:
junk <- as.data.frame(matrix(0,nrow=0,ncol=9))
Is there a sexier way?
cheers,
Rolf
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
2012 Oct 30
5
Swap rows and columns in a matrix
Dear R users,
I want a help to write an algorithm for swapping rows and columns in a matrix
thanks in advance
[[alternative HTML version deleted]]
2008 May 16
1
Making slope coefficients ``relative to 0''.
I am interested in whether the slopes in a linear model are different
from 0.
I.e. I would like to obtain the slope estimates, and their standard
errors,
``relative to 0'' for each group, rather than relative to some baseline.
Explicitly I would like to write/represent the model as
y = a_i + b_i*x + E
i = 1, ..., K, where x is a continuous variate and i indexes groups
(levels of a
2005 Jun 06
1
Missing values in argument of .Fortran.
I wish to pass a vector ``y'', some of whose entries are NAs to a
fortran subroutine which I am dynamically loading and calling by
means of .Fortran(). The subroutine runs through the vector entry by
entry; obviously I want to have it do one thing if y[i] is present
and a different thing if it is missing.
The way I am thinking of proceeding is along the xlines of:
ymiss <- is.na(y)
2006 May 29
2
newbie question: ROW average
Dimitris Rizopoulos wrote:
> look at ?rowMeans; you can also use "apply(mat, 1, mean)" but
> rowMeans() is better.
By my reading of the question, this is not what
Ezhil wants. He said:
``I have a 992 x 74 matrix. I would like to form a new matrix
by averaging each 4 rows from the original one.''
I.e. he wants (I think) the first row of the new matrix
to be the
2004 Oct 25
1
Scoping and nls.
A colleague of mine is trying to use nls() to effect an optimization,
and is encountering a scoping problem. I should know how to solve it
for him but .... well, I just don't.
I also had a quick scrounge of the archives --- I know I've seen this
topic addressed before --- but I couldn't track it down.
So here's a toy example that demonstrates the problem:
hhh <-
2006 Mar 17
1
Derivative of a splinefun function.
Is there a way of calculating the derivative of a function returned
by splinefun()? Such a function is a cubic spline, whence it has a
calculable derivative, but is there a (simple) way of getting at it?
One workaround that I have thought of is to take a fine grid of
points, evaluate the function returned by splinefun() at these
points, put an interpolating spline through these points using
2002 Nov 08
1
Using the ``...'' argument.
Suppose that I have a function fff which calls a couple of functions
foo and bar, and that foo takes optional arguments a and b, and bar
takes optional arguments u and v.
Is there an elegant way of passing ***both*** sets of optional
arguments via a ``...'' argument for fff?
I'd like to be able to have a structure like:
fff(x,y,z,...) {
.
a1 <- foo(x,y,...)
b1
2003 Apr 21
4
help.start in R-1.7.0 with Netscape 7.0.
I'm experiencing a new and annoying phenomenon which seems to consist
of an unfortunate interaction between R-1.7.0 and netscape version 7.
When I invoke help.start(), a netscape window duly appears
with the browser pointed at the file .../R/doc/html/index.html
as one would hope and expect.
However if I then ask for help on a function, e.g.
> help(glm)
the help does NOT get displayed
2012 May 19
1
Names of Greek letters stored as character strings; plotmath.
I had such good luck with my previous question to r-help, (a few minutes
ago) that I thought I would try again with the following query:
> Suppose I have
>
> xNm <- "gamma"
>
> I would like to be able to do
>
> plot(1:10,xlab = <something involving xNm">)
>
> and get the x axis label to be the Greek letter gamma
> (rather than the
2010 Nov 10
2
Centring titles for pairs of plots.
I would like to centre titles for pairs of plots in a 3-x-2
array. Each row of the array corresponds to a calendar year
and I would like to have the year value centred between the
two plots in the row, and just above their upper edges.
I have attached an example in "demo.pdf" showing roughly
what I want. I managed to produce the example using
2006 Jun 23
2
Generate Models & Controllers from Ruby program
Hi All.
I would like to create a model, database, and controller (if possible)
from a webapp. Each model and controller will each have 4 methods, and
the database will always have the same number of fields. I will
probably create the database through create_table or a direct SQL
command.
My question is this - is there a method that I can call to create the
model and controllers? Would it
2006 Jul 28
1
Comparison of linear models
Good afternoon,
I am a master student. I am currently doing an internship.
I would like to get some advices about the following issue: I have 2
data sets, both containing the same variables, but the data were
measured using two different procedures. I want to know if the two
procedures are equivalent.
Up to know, I have built one linear model for each dataset. The two
models have the same
2007 Aug 29
1
combining datasets by row
Rusers,
I am trying to append multiple .csv files of different dimensions (but
# of columns are the same for all .csv files). I do have .csv files
whose names are CA1.csv ~ CA100.csv. CA means california and 1 means
the first file. So what I have been doing (after googling how to append
by row multiple files) was:
cleanup_data<-function(state,count)
{
out<-matrix()
for (i in 1:
2009 Mar 03
4
Writing R package and do.call
Dear R-Help,
I have written a function, which in simplified format can be represented as:
temp.fn <- function(my.mean,my.sd){
Parameters <- list(mean = my.mean, sd = my.sd)
curve(do.call(dnorm,c(list(x), Parameters)), from = my.mean-my.sd,
to = my.mean+my.sd)
}
This works as I want it do. Wishing to immortalise this function into
my very own package however, results in the following
2006 Nov 25
3
OT: P(Z <= -1.46).
In checking over the solutions to some homework that I had assigned I
observed the fact that in R (version 2.4.0) pnorm(-1.46) gives
0.07214504. The tables in the text book that I am using for the
course give the probability as 0.0722.
Fascinated, I scanned through 5 or 6 other text books (amongst the
dozens of freebies from publishers that lurk on my shelf) and found
that some agree with R
2007 Apr 03
3
Referencing function name from within function
Hello,
For verbose coding I'd like to do something like:
> myfunction <- function(x){
> if (a){
> stop(paste(myfunction_name_here,"requires xyz!")
> }
Is that possible?
Thanks for any hints, Joh
2006 Oct 02
3
How can I generate this numbers
Hi wizards, I need to know how can I generate this numbers
I have n numbers N1,N2 , Nn , but Nn = 1- sum(N1+N2+...+Nn-1) and
sum(N1+N2+..Nn)=1
and N1,N2,..Nn with 0<N<1 .
Does somebody know how to generate it ? Some distribution or algorithm.
Thanks in advance.
--
Web Page
http://www.geocities.com/ricardo_rios_sv/index.html