Displaying 20 results from an estimated 10000 matches similar to: "repeated searching of no-missing values"
2008 Jul 29
1
tensor product of equi-spaced B-splines in the unit square
Dear all,
I need to compute tensor product of B-spline defined over equi-spaced
break-points.
I wrote my own program (it works in a 2-dimensional setting)
library(splines)
# set the break-points
Knots = seq(-1,1,length=10)
# number of splines
M = (length(Knots)-4)^2
# short cut to splineDesign function
bspline = function(x) splineDesign(Knots,x,outer.ok = T)
# bivariate tensor product of
2010 May 17
2
best polynomial approximation
Dear R-users,
I learned today that there exists an interesting topic in numerical
analysis names "best polynomial approximation" (BSA). Given a function
f the BSA of degree k, say pk, is the polynomial such that
pk=arginf sup(|f-pk|)
Although given some regularity condition of f, pk is unique, pk IS NOT
calculated with least square. A quick google tour show a rich field of
research
2008 May 29
2
Troubles plotting lrm output in Design Library
Dear R-helpers,
I'm having a problem in using plot.design in Design Library. Tho
following example code produce the error:
> n <- 1000 # define sample size
> set.seed(17) # so can reproduce the results
> age <- rnorm(n, 50, 10)
> blood.pressure <- rnorm(n, 120, 15)
> cholesterol <- rnorm(n, 200, 25)
> sex <-
2008 Aug 08
3
Multivariate regression with constraints
Hi all,
I am running a bivariate regression with the following:
p1=c(184,155,676,67,922,22,76,24,39)
p2=c(1845,1483,2287,367,1693,488,435,1782,745)
I1=c(1530,1505,2505,204,2285,269,1271,298,2023)
I2=c(8238,6247,6150,2748,4361,5549,2657,3533,5415)
R1=I1-p1
R2=I2-p2
x1=cbind(p1,R1)
y1=cbind(p2,R2)
fit1=lm(y1~-1+x1)
summary(fit1)
Response 2:
Coefficients:
Estimate Std. Error t value
2008 Jul 23
1
mle2(): logarithm of negative pdfs
Hi,
In order to use the mle2-function, one has to define the likelihood function
itself. As we know, the likelihood function is a sum of the logarithm of
probability density functions (pdf). I have implemented myself the pdfs
that I am using. My problem is, that the pdfs values are negative and I
cann't take the logarithm of them in the log-likelihood function.
So how can one take the
2008 Jul 29
3
table questions
Hi again!
Suppose I have the following:
> xy <- round(rexp(20),1)
> xy
[1] 0.1 3.4 1.6 0.4 1.0 1.4 0.2 0.3 1.6 0.2 0.0 0.1 0.1 1.0 2.0 0.9
2.5 0.1 1.5 0.4
> table(xy)
xy
0 0.1 0.2 0.3 0.4 0.9 1 1.4 1.5 1.6 2 2.5 3.4
1 4 2 1 2 1 2 1 1 2 1 1 1
>
Is there a way to set things up to have
0 - 0.4 0.5 - 0.9 etc. please?
I know there is the cut
2009 Dec 12
1
Replace NAs in a range of data frame columns
Dear all,
I'm stuck in a seemingly trivial task that I need to perform for many
datasets. Basically, I want to replace NA with 0 in a specified range of
columns in a dataframe. I know the first and last column to be recoded
only by its name.
I can select the columns starting like this
a[match('first',names(a)): match('last',names(a))]
The question is how can replace all NA
2009 May 07
1
data transformation using gamma
Hi R-users,
I have this code to uniformise the data using gamma:
> length(dp1)
[1] 696
> dim(dp1)
[1] 58 12
> dim(ahall)
[1] 1 12
> dim(bhall)
[1] 1 12
> trans_dt <- function(dt,a,b)
+ { n1 <- ncol(dt)
+ n2 <- length(dt)
+ trans <- vector(mode='numeric', length=n2)
+ dim(trans) <- dim(dt)
+ for (i in 1:n1)
+ { dt[,i] <- as.vector(dt[,i])
2009 May 04
2
Reversing axis label order
Dear R Users,
I am executing the following command to produce a line graph:
matplot(aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)
On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude).
2008 Jul 22
1
How to simulate heteroscedasticity (correlation)
Hi,
I would like to generate two correlated variables.
I found that funktion for doing that:
a <- rmvnorm(n=10000,mean=c(20,20),sigma=matrix(c(5,0.8*sqrt(50),
0.8*sqrt(50),10),2,2))
(using library(mvtnorm))
Now I also want to generate two correlated variables where the error
variance vary over the variable-correlation.
And I want to plot this for showing heteroscedasticity.
Like shown
2010 May 11
2
question about R
Hi,
At each iteration in my program,I need to generate tree vectors,X1,X2,X3,
from exponential distribution with parameters a1,a2,a3. Can you help me
please how can I do it such that it take a little time?
thank you
khazaei
2010 May 13
1
access objects in my environment
Dear group,
Here are my objects in my environment:
> ls()
[1] "Pos100415" "Pos100416" "posA" "pose15" "pose16" "pose16t"
"position" "trade" "x"
I need to pass the object "Pos100415" to a function. This element is a
data.frame, obtained through a function: Pos(x)<-myfun(x)
2009 Jun 08
0
ReadItem: unknown type 136, perhaps written by later version of R
Dear all,
I use at least two pc to perform my data analysis. Both are powered
with R updated at the latest release (currently 2.9.0 under windows xp
pro). I bring .Rdata on my portable drive and use them on any of my pc
(this worked also under (k)ubuntu equipped machines). Please notice
that not all my pc have the same libraries installed. If a not
installed library was called in .First() I got an
2008 Jul 23
8
sequential sum of a vector...
Hi R,
Let,
x=1:80
I want to sum up first 8 elements of x, then again next 8 elements of x,
then again another 8 elements..... So, my new vector should look like:
c(36,100,164,228,292,356,420,484,548,612)
I used:
aggregate(x,list(rep(1:10,each=8)),sum)[-1]
or
rowsum(x,group=rep(1:10,each=8))
But without grouping, can I achieve the required? Any other ways of
doing
2008 Jul 23
6
Convert list of lists <--> data frame
For a function that takes an argument as a list of lists of parameters,
I'd like to be able to convert that
to a data.frame and vice versa, but can't quite figure out how.
pats <- list(structure(list(shape = 0, shape.col = "black", shape.lty = 1,
cell.fill = "white", back.fill = "white", label = 1, label.size = 1,
ref.col = "gray80",
2008 Sep 19
2
migrating data from s-plus to R
Dear all,
is there any way to transform a .Data directory created in S-plus 6.1
for windows in a .RData file?
Thanks in advance,
Patrizio Frederic
2012 Dec 02
1
Repeated-measures anova with a within-subject covariate (or varying slopes random-effects?)
Dear all,
I am having quite a hard time in trying to figure out how to correctly
spell out a model in R (a repeated-measures anova with a
within-subject covariate, I guess). Even though I have read in the
posting guide that statistical advice may or may not get an answer on
this list, I decided to try it anyway, hoping not to incur in
somebody's ire for misusing the tool.
For the sake of
2008 Aug 01
2
contour lines in windows device but neither in pdf nor in postscript
library(mvtnorm)
x = seq(-4,4,length=201)
xy = expand.grid(x,x)
sigma = (diag(c(1,1))+1)/2
d2 = matrix(dmvnorm(xy,sigma=sigma),201)
xsamp = rmvnorm(200,sigma=sigma)
contour(x,x,d2)
points(xsamp,col=3,pch=16)
pdf("pdftry.pdf")
contour(x,x,d2)
points(xsamp,col=3,pch=16)
dev.off()
postscript("pstry.ps")
contour(x,x,d2)
points(xsamp,col=3,pch=16)
dev.off()
# I can see
2013 Aug 22
1
corrgram (package corrgram): how to plot multiple correlograms in the same page?
Hello,
I am trying to plot a few correlograms on the same figure, with the function corrgram() from the package corrgram. However, the function does not seem to use the base graphic system, as setting out the multiple figure layout with, e.g., par(mfrow=c(2, 2,)) does not work.
Does anybody know a workaround for this?
Many thanks in advance for any advice
best
giuseppe
--
Giuseppe Pagnoni,
2009 Apr 06
1
political maps world maps in R, wrld_simpl
dear all,
I'm a newbie in map tools. I was asking to perform an apparently very
simple task.
I have a list of countries (about fifty all over in the world) scored
with a real positive value. Eg
Country score
Italy .56
UK .58
Korea .41
Mexico .63
...
I wish to plot geographical maps where every country is filled with a
color depending on his score.
Using maptools library and