Displaying 14 results from an estimated 14 matches for "datamat".
2002 Dec 12
0
if problem in function
...ow chooses (and uses) the spruce parameter set
for the whole data object (because there is spruce on the first row?).
Could someone please give a hint on what's wrong.
Thanks!
Sincerely,
Tord
relev.kols$vol<- st?volfunk(relev.kols, tradhogst = "trad")
st?volfunk<- function(datamat, tradhogst=c("trad", "h?gst"))
{
# first pick out correct parameter sets. They depend on tree species
# if tree speciec is bjork (birch) -> choose
bjork.formh?jd.pars
# and bjork.h?jd.pars as pars1 and pars2, respective...
2011 Oct 18
1
Repeat a loop until...
...questions posted over the years about loops but I'm afraid that I'm still stuck. I am using Windows XP and R 2.9.2.
I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.]
> datamat <- rmnorm(n=1500,mean=c(mean(sanad[,1]),mean(sanad[,2]),mean(sanad[,3])),varcov=covmat)
The middle column of 'datamat' is simulated data for age. Obviously some of the simulated values are not going to be sensible. Therefore I'd like to set up a function that looks at each row of...
2011 Oct 25
1
regression using GMM for mulltiple groups
...he GMM estimates for CAPM
(REGRESSION) for 36 stocks each have 180 observations,however it only gives
me one output rather than 36.
In SAS i would just put in a *By statement*. I have a variable TICKER that
categorize them into 36 groups.
*How can I obtain all 36 output instead of just one.*
**
DataMat<-read.table(file="C://Users//ssenriqu//Dropbox//Work//Risk//data//CRSP//CRPS
2 original1.csv",sep=",",dec=".",header=TRUE)
require(gmm)
Returns <- DataMat[1:6480,"Returns"]
VWRET <- DataMat[1:6480,"VWRET"]
RF <- DataMat[1:6480,"RF&q...
2010 Feb 16
1
Math.factor error message
Dear R-helpers,
I am using a vrtest on time series data. My commands are as follows;
read.table("B.txt",sep="\t",fill=TRUE, na.strings = "NA")
require(vrtest)
rm(list=ls(all=TRUE))
datamat <- read.table("B.txt",sep="\t",fill=TRUE, na.strings = "NA")
column <- 1
nob <- nrow(datamat)
y <- log(datamat[2:nob,column])-log(datamat[1:(nob-1),column])
After, the use of last command, I get the following message;
in Math.factor(c(37L, 36L, 42L...
2004 Jul 23
0
problem lme using corSymm()
...0.13769743 0.09924456 0.08767253
[17,] 0.20091098 0.09847140 0.14685682 0.16175769 0.18205527 0.13926859
[18,] 0.11707101 0.13492758 0.07762873 0.13414458 0.11760926 0.13963532
As you can see, values in row [15,] and columns [,3] to [,5] are very
similar. To produce a vertical design matrix use:
datamat<-as.data.frame(test)
datamat<-stack(datamat)
datamat$subject<-as.factor(rep(c(1:18),times=6))
datamat$A<-as.factor(rep(c(1:3),each=18,times=2))
datamat$B<-as.factor(rep(c("one","two"),each=54))
Then fitting the model:
fm.datamat<-lme(values~A*B,data=data...
2003 Jan 29
3
multinomial conditional logit models
...* Each case must be identified by a strata variable (id)
* Each duplicate must be identified by a variable indexing the
choices (newy)
* A dichotomous variable must indicate which duplicate corresponds
with the respondent's choice (didep)
I've done this as follows:
mclgen <- function (datamat,catvar) {
ncat <- nlevels(catvar)
id<-1:length(catvar)
datamat<-cbind(id,datamat)
perschoice <-NULL
for (i in 1:ncat) {
perschoice<-rbind(perschoice,datamat)
}
perschoice<-perschoice[sort.list(perschoice$id),]
perschoice$newy<-gl(ncat,1,length=nrow(perschoice))
dep&l...
2011 Jun 27
1
Hardy Weinberg Simulation
...ues are not what I am expecting. I want
to use the Cochran Armitage trend test to get the p-values.
num.reps=10
num.vars=1000
pi0 = 80
num.subjects = 100
#Create list control list.control and list.treatment
#Minor alleles will be from (0.10, 0.30)
#num.subjects is the number of subjects in each
datamat = matrix(0,num.vars,3)
list.treat <- vector("list", 1) # create list
for (i in 1: num.reps)
{
list.treat[[i]] <- matrix(0, nrow = num.vars, ncol=3)
}
for ( k in 1: num.reps)
{
minor.allele.prop = runif(num.vars, 0.10, 0.30)
###################################
##### Generating und...
2011 Jan 12
1
Grouped bars in barplot
Dear all,
I am trying to make a barplot with clustered pairs of bars, using class=numeric data and the following command:
barplot(c(bline_precip[10,9], bline_runoff[10,9], cccma_precip[10,9], cccma_runoff[10,9], csiro_precip[10,9], csiro_runoff[10,9], ipsl_precip[10,9], ipsl_runoff[10,9], mpi_precip[10,9], mpi_runoff[10,9], ncar_precip[10,9], ncar_runoff[10,9], ukmo_precip[10,9],
2010 May 10
2
Warning message
...---------------------------------------------------------------------------
library(mvtnorm);
s12<-c(1:1000);
var21<-lapply(s12,function(x){
rs<-rmvt(10, sigma=diag(8), df=1);
my<-mean(rs);
sy<-sqrt(var(rs))
return(cbind(my,sy))
});
data1<-do.call(rbind,var21);
dataMat<-data.frame(data1);
W<-dataMat$my;
hist(W,breaks=20,probability=T)
-----------------------------------------------------------------------------------
Thanks.
Shant
[[alternative HTML version deleted]]
2002 Jun 21
1
naming things in functions
...blem is that when PercentsMat is called from within a loop in
SummaryMat, where list names are indexed, the rows in the generated
matrix are labeled with the index name rather than its value. That is,
for example, I'm ending up with ri, ri, ri rather than r1, r2, r3.
SummaryMat <- function(datamat, numclusts, runs, fzmeasure)
for( j in numclusts )
for( i in 1:runs ) {
k = k+1
.
.
.
sepclusters[k] = list( ClusterSep(clusters[[k]]) ) #
separate data into individual clusters
names(sepclust...
2012 Nov 21
0
Question about VAR (Vector Autoregression) in differences.
...ne else's code for other purposes.
# Modified VAR simulation function jigged up from the predict function of vars package
simVARpath<-function(object, n.ahead, mult = 1) {
K <- object$K
p <- object$p
obs <- object$obs
type <- object$type
data.all <- object$datamat
ynames <- colnames(object$y)
n.ahead <- as.integer(n.ahead)
Z <- object$datamat[, -c(1:K)]
B <- Bcoef(object)
if (type == "const") {
Zdet <- matrix(rep(1, n.ahead), nrow = n.ahead, ncol = 1)
colnames(Zdet) <- "const"
}...
2008 Jan 07
1
numerical data frame
Dear All,
I've successfully import my synteny data to R by using scan command. Below show my results. My major problem with my data is how am i going to combine the column names with the data( splt) where i have tried on cbind but a warning message occur. I have realized that the splt data only have 5 column instead of 6. Please help me with this!!
I want my data to be a numerical
2005 Jul 28
4
CSV file and date. Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file
as a CSV file). The columns containing dates are being read as factors.
Because of this, I can not compute follow-up time, i.e.
Followup<-postDate-preDate. I would appreciate any suggestion that would
help me read the dates as dates and thus allow me to calculate follow-up
time.
Thanks
John
John Sorkin M.D., Ph.D.
Chief,
2011 Jun 30
0
help with interpreting what nnet() output gives:
...rmat=flowed; charset="US-ASCII"
>
> I have the code below but the p-values are not what I am expecting. I want
> to use the Cochran Armitage trend test to get the p-values.
What do you expect? Depending on the genetic model, you may not see HWE in the
"cases".
> datamat[h,] <- t(rmultinom(1, size=c(10, 40, 50), prob=c(0.33, 0.33, 0.34)))
"size" should be the total size ie 100.
--
| David Duffy (MBBS PhD) ,-_|\
| email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / *
| Epidemiology Unit, Quee...