Displaying 20 results from an estimated 400 matches similar to: "Error in apply(x2, 1, diff) : dim(X) must have a positive length"
2009 Jul 15
1
Matrix multiplication precision
Hi!!
I am trying to multiply 5 matrices and then using the inverse of that matrix for further computation. I read about precision problems from the archives and the suggestion was to use as.numeric while computing the products. I am still having problems with the results. Here is how I am using it
#Mn.mat<-(T.mat %*% Rz.mat %*% Q.mat %*% Rz.mat %*% T.mat) # I was doing this in one step
2009 Jan 26
0
why two diff. se in nlsList?
Hi list,
In the object returned by summary.nlsList, what's the difference between "coefficients" and "parameters"? The have the same "Estimate", different se (therefore t value), but same p values.
R.2.8.0 on winxp with nlme_3.1-89
Thanks,
...Tao
+++++++++++++++++++++++++++++++++++++++++++++++++
> library(nlme)
> fm1 <- nlsList(uptake ~
2008 Apr 14
5
Equivalent to a BY command in SAS
Hi,
I'm very new to R and absolutely love it. Does anyone know how to use
something in R that functions like a BY command in SAS?
For example, let's say you have a variable x, and you want to see the mean.
Easy...
> mean(x)
But what if you want to see the mean of x conditional on another discrete
variable? My best attempts so far are something like...
> mean(x, y_cat=1)
2017 Oct 08
2
Manipulations with CO2 dataset on R
Hi,
I just started a new course this semester on R, I never used it in my life and i'm stuck on these questions from 3 days, it would be really nice if someone could explain me the answers with the relative commands.
thanks a lot in advance
The following 7 questions are based on the CO2 dataset of R.
1) How many of the plants in CO2 are Mc2 for Plant?
2) How many are either Mc2 or Mn2?
2003 Sep 07
3
bug in crossprod? (PR#4092)
# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
# r-bugs@r-project.org
#
######################################################
# The last line of following code produces a segmentation fault:
x <- 1:10
f <- gl(5,2)
2005 Jun 24
1
lme4 extracting individual variance components
Hi,
For further calculations I need to extract indivdual Variances of
different random effects from a fitted model.
I found out how to extract the correlations
(VarCorr(m1)@reSumry$group1) but I was not able to find a way to
extract the other components individually.
To extract the Residuals I tried: (ranef(m1)@ stdErr) which
unfortunately did not work.
Thank you very much for your help!
2007 Jul 13
3
Direction of panel plots in trellis graphics
Hi,
Using library(lattice), is there any way to tell xyplot to plot
panels top to bottom, then left to right (i.e. panels are appended
vertically, then horizontally). as.table changes the plot direction
from left-to-right then top-to-bottom, to right-to-left then bottom-
to-top, but that's not quite what I want to do.
Thanks
Yan
2018 Apr 27
5
predict.glm returns different results for the same model
Hi all,
Very surprising (to me!) and mystifying result from predict.glm(): the
predictions vary depending on whether or not I use ns() or
splines::ns(). Reprex follows:
library(splines)
set.seed(12345)
dat <- data.frame(claim = rbinom(1000, 1, 0.5))
mns <- c(3.4, 3.6)
sds <- c(0.24, 0.35)
dat$wind <- exp(rnorm(nrow(dat), mean = mns[dat$claim + 1], sd =
sds[dat$claim + 1]))
dat <-
2011 Feb 09
1
add mean and sd to dotplot in each panel using lattice
Hi,
I have a data frame like this:
ScoreDoseSex
2.81Dose1M
1.81Dose1M
1.22Dose1M
0.81Dose1M
0.49Dose1M
0.22Dose1M
0.00Dose1M
-0.19Dose1M
-0.17Dose1F
-0.32Dose1F
-0.46Dose1F
-0.58Dose1F
-0.70Dose1F
-0.81Dose1F
-0.91Dose1F
-1.00Dose1F
-1.77Dose2M
-1.85Dose2M
-1.93Dose2M
-2.00Dose2M
-2.07Dose2M
-2.14Dose2M
-2.20Dose2M
-2.26Dose2M
-2.32Dose2F
-2.38Dose2F
-2.17Dose2F
-2.49Dose2F
-2.54Dose2F
2007 Sep 11
2
Function to get a sequence of months
Hi all,
I am looking for a function for following calculation.
start.month = "July"
end.month = "January"
months = f(start.month, end.month, by=1)
* f is the function that I am looking for.
Actually I want to get months = c("July", "August",.............."January")
If start.month = 6 and end.month = 1 then I could use (not properly) seq()
2008 Dec 19
2
error bars
Dear Help
I'm new to R (from matlab)...using windows XP.
I've tried to work out, to no avail, 4 things:
1) rotating the numbers on axes...something to do with par(str) ??
2) how to close a window having opened one e.g. windows(7,7)
3) how to manipulate the key (e.g. dots, lines etc) on the legend. Using pch just gives me the same key for all functions on a plot.
i.e. legend
2014 May 08
3
[LLVMdev] Small problem with the tail call elimination pass
Hello everybody,
On the documentation page for the tailcallelim pass you can read:
"This pass transforms functions that are prevented from being tail recursive by an
associative expression to use an accumulator variable, thus compiling the typical
naive factorial or fib implementation into efficient code”
However, I don’t see this behavior when trying to compile this variant of
the
2002 Mar 05
3
newbie: remove column with low mean from a matrix
Dear all,
Sorry to bother you with one more newbie question.
I have a dataobject with several hundreds of columns. I want to remove
columns with a mean of the column values below a certain value:
> a<- c(1,2,3,4,5,6)
> b<-c(2,4,6,8,10,12)
> c<- c(3,6,9,12,15,18)
> test<- as.matrix(cbind(a, b, c))
> mean(a)
[1] 3.5
> mean(b)
[1] 7
> mean(c)
[1] 10.5
Say the
2008 Jan 30
4
Loop with variable index
I have a list of 20 values. The first time through a loop I want to find the
mean and stnd.dev. of the first two values; the second time through the loop
I want to find the mean and stnd. dev. of the first 3 values, etc. until
the last time through the loop I want to find the mean and stnd. dev. of all
20 values, so I end up with 19 means and stnd. deviations.
How would I construct such a loop?
2000 Jun 07
1
forward stepwise selection
Dear R-Help,
My problem/bug came to light,when fitting a linear model using stepwise
selection. I'd started with the straightfoward command
step(lm(y~., dataset))
This worked fine, but because this starts with all the possible
explanatory variables, it results in a model with too many explanatory
variables. Hence I wanted to start with just a constant and do forward
selection, to get a
2006 Apr 04
1
generating LaTeX tables from Match output
Dear R users,
I am using the Match function to generate nearest neighbor matching
estimators. On that front I am ok, but where I am having problems is
getting my output into nice LaTeX tables.
Here is some basic code imitating the estimation I'm doing. No problem there.
library(Matching)
#make up some data
X1 <- matrix(rnorm(1000*5), ncol=5)
Y1 <- as.vector(rnorm(1000))
Tr1 <-
2010 Jan 29
2
Vectors with equal sd but different slope
Hi,
what I would need are 2 vector pairs (x,y) and (x1,y1). x and x1 must have
the same sd. y and y1 should also exhibit the same sd's but different ones
as x and x1. Plotting x,y and x1,y1 should produce a plot with 2 vectors
having a different slope. Plotting both vector pairs in one plot with fixed
axes should reveal the different slope.
many thanks
syrvn
--
View this message in
2012 Mar 30
4
Trying to understand factors
I'm trying to figure out about factors, however the on-line documentation is
rather sparse. I guess, factors are intended for grouping arrays members into
categories, which R names "Levels". And so we have:
* state <- c("tas", "sa", "qld", "nsw", "nsw", "nt", "wa", "wa",
2010 Aug 30
2
while loop until end of file
Hi Guys,
stumped by a simple problem. I would like to take a file of the form
Pair group param1
1 D 10
1 D 10
1 R 10
1 D 10
2 D 10
2 D 10
2 D 10
2 R 10
2 R 10
etc..
and for each pair, calculate the average of
2001 Mar 10
3
Problem With Model.Tables Function
I am using R for the first time in one of my classes. My students have
alerted me to a problem for which we have not found an answer. We find
that some means returned by the model.tables function are not correct when
missing data is present in analysis of variance problems. We have
duplicated the problem using R 1.2.0, 1.2.1, and 1.2.2 under Windows 98
and several distributions of Linux (Redhat