Displaying 20 results from an estimated 500 matches similar to: "Can plot() be used for multiple plots?"
2011 Nov 17
1
Vectorizing for weighted distance
Hi All,
I am trying to convert the following piece of matlab code to R:
XX1 = sum(w(:,ones(1,N1)).*X1.*X1,1); #square the elements of X1,
weight it and repeat this vector N1 times
XX2 = sum(w(:,ones(1,N2)).*X2.*X2,1); #square the elements of X2,
weigh and repeat this vector N2 times
X1X2 = (w(:,ones(1,N1)).*X1)'*X2; #get the weighted
'covariance'
2002 Jun 28
1
Problem in optim(method="L-BFGS-B") (PR#1717)
Full_Name: Jörg Polzehl
Version: 1.5.1
OS: Windows 2000
Submission from: (NULL) (193.175.148.198)
When calculating MLE's in a variance component model using constrained
optimization, i.e. optim(...,method="L-BFGS-B",...) I observed an inproper
behaviour in cases where
the likelihood function was evalueted at the constraint. Parameters and value of
the
function at the constraint
2009 Nov 04
3
Constrained Optimization
Hi All,
I'm trying to do the following constrained optimization example.
Maximize x1*(1-x1) + x2*(1-x2) + x3*(1-x3)
s.t. x1 + x2 + x3 = 1
x1 >= 0 and x1 <= 1
x2 >= 0 and x2 <= 1
x3 >= 0 and x3 <= 1
which are the constraints.
I'm expecting the answer x1=x2=x3 = 1/3.
I tried the "constrOptim" function in R and I'm running into some issues.
I first start off
2007 Oct 26
1
Fwd: Ajuda em R
An embedded and charset-unspecified text was scrubbed...
Name: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071026/5710517e/attachment.pl
2012 Apr 19
3
Bivariate normal integral
hello,
I'm trying to improve the speed of my calculation but didn't get to a
satisfying result.
It's about the numerical Integration of a bivariate normal distribution.
The code I'm currently using
x <-
qnorm(seq(.Machine$double.xmin,c(1-2*.Machine$double.eps),by=0.01),
mean=0,sd=1)
rho <- 0.5
integral <- function(rho,x1){
2012 Feb 13
2
Error in apply(x2, 1, diff) : dim(X) must have a positive length
Anyone knows hat might be the cause of this error? Thanks for any help!
>library(MASS)
> dif.mns = function(x2,tr1=.2,tr2=.3){
+ #generates four different 'means' using
+ #difference scores from x2, an n x 2 matrix
+ #for use w/ bootstrap comparisons
+ diffs = apply(x2,1,diff)
+ mn1=mean(diffs)
+ mn2=mean(diffs,tr=.2)
+ mn3=mean(diffs,tr=.3)
+
2006 Sep 27
3
Space required by object?
Does R provide a function analogous to LS() or str() that reports the
storage space, on disk or in memory, required by objects?
Ben Fairbank
2006 Dec 14
5
Better way to change the name of a column in a dataframe?
Hello R users --
If I have a dataframe such as the following, named "frame" with the
columns intended to be named col1 through col6,
> frame
col1 col2 cmlo3 col4 col5 col6
[1,] 3 10 2 6 5 7
[2,] 6 8 4 10 7 1
[3,] 7 5 1 3 1 8
[4,] 10 6 5 4 9 2
and I want to correct or otherwise change the
2007 Apr 24
4
Size of an object in workspace
Hi folks,
Is there a function to show the size of an R object? eg. in Kbytes?
Couple months ago Bendix Carstensen posted this marvelous little function lls(), which shows all objects in the current workspace by mode, class and 'size'. This is a wonderful enhancement to the build-in ls() already and I now have it sourced in my Rprofile.site at startup.
The only drawback is,
2006 Jan 05
2
Splitting the list
I've changed the heading because this really is another thread. I
think it inevitable that there will, in the course of time, be other
lists that are devoted, in some shape or form, to the concerns of
practitioners (at all levels) who are using R. One development I'd
not like to see is fracture along application area lines, allowing
those who are comfortable in coteries whose
2013 Mar 05
2
Issues when using interaction term with a lagged variable
Hi there!
Today I tried to estimate models using both plm and pgmm functions, with an
interaction between X1 and lag(X2, 1). And I notice two issues.
Let "Y=b_1 * X_1 + b_2 * X_2 + b_3 * X_1 * x_2 + e" be our model.
1) When using plm, I got different results when I coded the interaction
term with I(X1 * lag(X2, 1)) and when I just saved this multiplication X1 *
lag(X2, 1) in a
2008 Jun 20
2
The Green Book and its relevance to R
I bogged down about half way through reading the Green Book, in part
because it became increasingly difficult to understand how some of the
ideas related to R, as opposed to S (which I have not used). Does any
reader know whether there is a document that points out differences
between S and R that would be helpful in reading the Green Book?
Ideally, perhaps, I need a "crib sheet" to
2007 Jan 19
4
Newbie question: Statistical functions (e.g., mean, sd) in a "transform" statement?
Greetings listeRs -
Given a data frame such as
times
time1 time2 time3 time4
1 70.408543 48.92378 7.399605 95.93050
2 17.231940 27.48530 82.962916 10.20619
3 20.279220 10.33575 66.209290 30.71846
4 NA 53.31993 12.398237 35.65782
5 9.295965 NA 48.929201 NA
6 63.966518 42.16304 1.777342 NA
one can use "transform" to
2008 Jan 30
1
"hist" combines two lowest categories -- is there a workaround?
When preparing a series of histograms I found that hist was combining
the two lowest categories or bins, 1 and 2. Specifying breaks, as
illustrated below, resulted in the correct histogram:
values <- sample(10,500,replace=TRUE)
hist(values)
hist(values,breaks = 0:10)
Apparently, the number of values strictly less than 1 is shown in the
first bin (and since none is less than 1,
2005 Jun 28
1
Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)
I am finding complex analyses easier than some elementary operations in
R. In particular I want to do some low level exploratory data analyses
with data in a data frame but cannot find commands to easily insert,
remove (delete), rename, and re-order (arbitrarily, not sort) columns.
I see that the micEcon package has an insertCol command, but that is for
matrices, not data frames. I have looked
2007 Mar 02
1
Help with faster optimization for large parameter problem
Hello all,
I have a large parameter problem with the following very simple likelihood
function:
fn<-function(param) {
x1<-param[1:n]
g1<-param[(n+1):(2*n)]
beta<-param[(2*n+1):(2*n+k)]
sigma2<-param[2*n+k+1]^2
meang1sp<-mean(g1[sp])
mu<-beta%*%matrix(x1,1,n)-(g1[sp]-meang1sp)%*%matrix(g1,1,n)
return(sum((ydc-mu)^2)/(2*sigma2) + n*k*log(sqrt(sigma2)) +
2008 Apr 07
1
Width of text displayed in R
All,
I think this is pretty basic but I couldn't find the answer in any
source.
I have just built my own R for Linux (amd 64). It runs well, but R
thinks that it only has 80 characters or so of screen width. I log on
with Putty to the box and can stretch it as large as I want.
Is there a simple way to tell R to use more screen width when
displaying?
From whatami:
OS RELEASE :
2008 Apr 09
1
read table not reading lines containing single quotes
Hi,
* I am using read.table command as follow
kegg<-read.table("c:/IDs.tab",header =TRUE,quote= "'", sep="\t") *
Fragment of file is as follow:
ID Pathway
04916 Melanogenesis
04920 Adipocytokine signaling pathway
04930 Type II diabetes mellitus
04940 Type I diabetes mellitus
04950 Maturity onset diabetes of the young
05010
2008 Apr 25
3
How to overlap two density plots?
Hi,
How can I overlap two density plots?
A <- c(8,10,10,11,11,11,12,12,12,12,11,11,11,10,10,7)
B <- c(11,13,13,14,14,14,15,15,15,15,14,14,14,13,13,10)
plot(density(A))
plot(density(B))
Regards,
Emre
P.S. There's a overlap.density function in package DAAG
Is there another way to do this?
--
---
Emre ÜNAL
http://www.geocities.com/dusemre
[[alternative HTML version
2008 Apr 07
2
read.table with multiple header lines
Hello,
I have difficulties in reading in a text file with multiple (=2) header lines. My table looks like this:
id code gr grcode AA AB AC AD
time 30 40 50 60
1 1234 1 c 0 1 0 0
2 1346 1 c 0 0 0 1
3 1456 1 c 0 0 1 1
4 1893 1 c 0 0 1 1
Can someone help me out?
Thanks
Deborah
--