similar to: How to simulate heteroscedasticity (correlation)

Displaying 20 results from an estimated 1000 matches similar to: "How to simulate heteroscedasticity (correlation)"

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 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 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 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
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).
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)
2008 Dec 10
4
repeated searching of no-missing values
hi all, I have a data frame such as: 1 blue 0.3 1 NA 0.4 1 red NA 2 blue NA 2 green NA 2 blue NA 3 red 0.5 3 blue NA 3 NA 1.1 I wish to find the last non-missing value in every 3ple: ie I want a 3 by 3 data.frame such as: 1 red 0.4 2 blue NA 3 blue 1.1 I have written a little script data = structure(list(V1 = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L ), V2 = structure(c(1L, NA,
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
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",
2017 Aug 16
4
{nlme} Question about modeling Level two heteroscedasticity in HLM
Hello dear uesRs, I am working on modeling both level one and level two heteroscedasticity in HLM. In my model, both error variance and variance of random intercept / random slope are affected by some level two variables. I found that nlme is able to model heteroscedasticity. I learned how to use it for level one heteroscedasticity but don't know how to use it to model the level
2008 Sep 04
2
Correct for heteroscedasticity using car package
Dear all, Sorry if this is too obvious. I am trying to fit my multiple regression model using lm() Before starting model simplification using step() I checked whether the model presented heteroscedasticity with ncv.test() from the CAR package. It presents it. I want to correct for it, I used hccm() from the CAR package as well and got the Heteroscedasticity-Corrected Covariance Matrix. I am not
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
2017 Aug 16
0
{nlme} Question about modeling Level two heteroscedasticity in HLM
If you don't get a response it is because you did not read the Posting Guide which indicates that the R-sig-ME mailing list is where this question would have been on-topic. -- Sent from my phone. Please excuse my brevity. On August 16, 2017 6:17:03 AM PDT, b88207001 at ntu.edu.tw wrote: >Hello dear uesRs, > >I am working on modeling both level one and level two
2009 Feb 10
2
Help regarding White's Heteroscedasticity Correction
Hi I am actually running the White test for correcting Heteroscedasticity. I used sandwich() & car(), however the output shows the updated t test of coefficients, with revised Standard Errors, however the estimates remained same. My problem is that the residuals formed a pattern in the original regression equation. After running the White's test, I got some new standard errors - but
2016 Apr 15
1
Heteroscedasticity in a percent-cover dataset
Hi, I am currently trying to do a GLMM on a dataset with percent cover of seagrass (dep. var) and a suite of explanatory variables including algal (AC) and epiphyte cover (EC), rainfall, temperature and sunshine hours. M2=glmer(SG~AC+EC+TP+SS+RF+(1|Location/fSi/fTr), family=binomial,data=data,nAGQ=1) As the dependent variable is percent cover, I used a binomial error structure. I also have a