similar to: How to generate normal mixture random variables with given covariance function

Displaying 20 results from an estimated 2000 matches similar to: "How to generate normal mixture random variables with given covariance function"

2003 Oct 23
1
Variance-covariance matrix for beta hat and b hat from lme
Dear all, Given a LME model (following the notation of Pinheiro and Bates 2000) y_i = X_i*beta + Z_i*b_i + e_i, is it possible to extract the variance-covariance matrix for the estimated beta_i hat and b_i hat from the lme fitted object? The reason for needing this is because I want to have interval prediction on the predicted values (at level = 0:1). The "predict.lme" seems to
2013 Feb 18
2
error: Error in if (is.na(f0$objective)) { : argument is of length zero
Dear all, I tried running the following syntax but it keeps running for about 4 hours and then i got the following errors: Error in if (is.na(f0$objective)) { : argument is of length zero In addition: Warning message: In is.na(f0$objective) : is.na() applied to non-(list or vector) of type 'NULL' Here is the syntax itself: library('nloptr') library('pracma') #
2003 Jul 10
1
The question is on Symmetry model for square table.
Please help, I tried a program on S-plus, and it worked. Also I tried the same program on R but not worked. Here is the programme. I put it in a function form. The model and assumption are at the bottom. where counts<-c(22,2,2,0,5,7,14,0,0,2,36,0,0,1,17,10) which is name.data, i is row size and j is the column size. symmetry function(i, j, name.data) { row <- (c(1:i)) col <-
2005 Mar 23
4
sampling from a mixture distribution
Dear R users, I would like to sample from a mixture distribution p1*f(x1)+p2*f(x2). I usually sample variates from both distributions and weight them with their respective probabilities, but someone told me that was wrong. What is the correct way? Vumani
2010 Jul 13
1
Batch file export
Dear all, I have a code that generates data vectors within R. For example assume: z <- rlnorm(1000, meanlog = 0, sdlog = 1) Every time a vector has been generated I would like to export it into a csv file. So my idea is something as follows: for (i in 1:100) { z <- rlnorm(1000, meanlog = 0, sdlog = 1) write.csv(z, "c:/z_i.csv") Where "z_i.csv" is a filename that is
2007 Mar 09
1
help with zicounts
Dear UseRs: I have simulated data from a zero-inflated Poisson model, and would like to use a package like zicounts to test my code of fitting the model. My question is: can I use zicounts directly with the following simulated data? Create a sample of n=1000 observations from a ZIP model with no intercept and a single covariate x_{i} which is N(0,1). The logit part is logit(p_{i})=x_{i}*beta
2010 Nov 03
1
Orthogonalization with different inner products
Suppose one wanted to consider random variables X_1,...X_n and from each subtract off the piece which is correlated with the previous variables in the list. i.e. make new variables Z_i so that Z_1=X_1 and Z_i=X_i-cov(X_i,Z_1)Z_1/var(Z_1)-...- cov(X_i,Z__{i-1})Z__{i-1}/var(Z_{i-1}) I have code to do this but I keep getting a "non-conformable array" error in the line with the covariance.
2002 May 14
2
tapply and empty subsets
I am using tapply to compute means by group, as in > tapply(y, z, mean) 1 2 3 21.00757 20.50031 NA where y is a vector and z a factor with levels 1:3. I would like to get a zero instead of the NA I get when a subset is empty. The problem is that FUN is not applied to empty cells of the ragged array. (Of course I am willing to define a function my.mean that returns
2010 Aug 18
3
libreadline problem
Hello, Recently updated Ubuntu to 10.04, I have installed the r-base and r-base-dev packages from CRAN with sudo apt-get install r-base But now when I want to start R I get the following error: gpetris at definetti:~$ R /usr/lib/R/bin/exec/R: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: PC Any clue??? Has anybody seen that before? I have tried to reinstall the
2003 Oct 29
1
restarting split.screen
Is there a way of `restarting' split.screen? This is what I am getting: > close.screen() [1] 10 11 12 13 > close.screen(all=TRUE) Error in par(args) : parameter "i" in "mfg" is out of range > graphics.off() > x11() > close.screen() [1] 10 11 12 13 > close.screen(all=TRUE) Error in par(args) : parameter "i" in "mfg" is out of range As
2007 Jan 18
4
Reading contingency tables
I am trying to read an ftable using read.ftable, but I get the following error message: > jobSatTable <- read.ftable("http://definetti.uark.edu/~gpetris/stat5333/jobSatisfaction.dat",skip=2) Error in seek(file, where = 0) : no applicable method for "seek" In addition: Warning messages: 1: no non-missing arguments to max; returning -Inf 2: no non-missing arguments to
2004 May 12
4
non-interactive call to R (running an R package as a stand-alone application)
Is there a way I can have R automatically execute the commands in a source file without ever having to use R interactively? If so, what arguments should I pass to the UNIX call to R? I need to do this to run several R jobs in parallel. An alternative may be to have R and an R package behave as a stand-alone application that can be called from the UNIX command line. Is there any documentation on
2008 Oct 09
2
Two math expressions in plot
Hello! I am trying to put two math expressions in the title of a plot. As you can see below, I can place correctly one expression at a time, but not both. Ideally I would like to have them separated by a comma. Any suggestions? > k <- 1 > n.eff <- c(20, 30) > ### this works > plot(0,0, main = substitute(n == k, list(k = k))) > ### this works > plot(0,0, main =
2008 Dec 08
1
DLM - Covariates in the system equation
Is there a way to add covariates to the system equation in a time-varying approach: Y[t] = F'[t]theta[t] + v[t], v[t] ~ N[0,V] #observation equation theta[t] = theta[t-1] + psi*Z[t] + w[t], w[t] ~ N[0,W] #system equation While F[t] is a matrix of regressors to capture the short term effect on the response series Y, Z[t] measures the long-term effect of either (1) two policies by a step
2003 Oct 24
5
how to remove NaN columns ?
How can I remove columns with NaN entries ? Here is my simple example: > data <- read.csv("test.csv") > xdata <- data[3:length(data)] > xs <- lapply(xdata, function(x){(x - mean(x))/sqrt(var(x))}) > x <- data.frame(xs) > x C D E F 1 -0.7071068 NaN -0.7071068 -0.7071068 2 0.7071068 NaN 0.7071068 0.7071068
2011 Mar 09
4
Help with read.csv
Hello, I have a file that looks like this: Date,Hour,DA_DMD,DMD,DA_RTP,RTP,, 1/1/2006,1,3393.9,3412,76.65,105.04,, 1/1/2006,2,3173.3,3202,69.20,67.67,, 1/1/2006,3,3040.0,3051,69.20,77.67,, 1/1/2006,4,2998.2,2979,67.32,69.10,, 1/1/2006,5,3005.8,2958,65.20,68.34,, where the ',' is the separator and I tried to read it into R, but... > y <- read.csv("Data/Data_tmp.csv",
2012 May 25
1
knitr customization
I am trying to transition from Sweave to knitr, but there are a few things about customization of the appearence of R input and output that I did not get yet. Maybe somebody on the list can help me. In my Sweave presentations I used a slanted font for the R input and a normal font for the output, both in a small font. I also indented everything by an extra 2em. All this was achieved by the
2004 Feb 06
3
quantile function
I am trying to `cut' a continuous variable into contiguous classes containing approximately an equal number of observations. I thought quantile() was the appropriate function to use in order to find the breakpoints, but I end up with classes of different sizes - see example below. Does anybody have an explanation for that? And what is the `recommended' way of computing what I am looking
2002 Jan 18
3
Shared libraries for use with R
I am moving my first steps in writing and compiling C code and calling it from R. (I am also new to shared libraries...) My problem is that my C code uses a C function contained in another library (".a", not ".so" - is that the problem?). This is how I compile the file with the functions I want to call from R: cd /export/home/gpetris/ R SHLIB tryit.c cc
2012 May 09
1
Sweave, beamer and alert within code chunks
Hi all, Using Beamer, in order to highlight a piece of R code I do something like this - note the "\structure" and "\alert" commands: \begin{semiverbatim} > mleOut <- \structure{dlmMLE}(Nile, + parm = c(0.2, 120), # initial values for optimizer + lower = c(1e-7, 0)) \alert<2>{# V must be positive} > mleOut$convergence