ComputeWeightedDifference {DSWE} | R Documentation |

## Percentage weighted difference between power curves

### Description

Computes percentage weighted difference between power curves based on user provided weights instead of the weights computed from the data. Please see `details`

for more information.

### Usage

```
ComputeWeightedDifference(
muDiff,
weights,
base,
statDiff = FALSE,
confBand = NULL
)
```

### Arguments

`muDiff` |
a vector of pointwise difference between two power curves on a testset as obtained from |

`weights` |
a vector of user specified weights for each element of |

`base` |
a vector of predictions from a power curve; to be used as the denominator in computing the percentage difference. It can be either |

`statDiff` |
a boolean specifying whether to compute the statistical significant difference or not. Default is set to |

`confBand` |
a vector of pointwise confidence band for all the points in the testset as obtained from |

### Details

The function is a modification to the percentage weighted difference defined in Ding et al. (2021). It computes a weighted difference between power curves on a testset, where the weights have to be provided by the user based on any probability distribution of their choice rather than the weights being computed from the data. The weights must sum to 1 to be valid.

### Value

a numeric percentage weighted difference or statistical significant percetage weighted difference based on whether statDiff is set to `FALSE`

or `TRUE`

.

### References

For details, see Ding et al. (2021) available at doi:10.1016/j.renene.2021.02.136.

### Examples

```
ws_test = as.matrix(seq(4.5,8.5,length.out = 10))
userweights = dweibull(ws_test, shape = 2.25, scale = 6.5)
userweights = userweights/sum(userweights)
data1 = data1[1:100, ]
data2 = data2[1:100, ]
datalist = list(data1, data2)
xCol = 2
xCol.circ = NULL
yCol = 7
testCol = 2
output = ComparePCurve(data = datalist, xCol = xCol, yCol = yCol,
testCol = testCol, testSet = ws_test)
weightedDiff = ComputeWeightedDifference(output$muDiff, userweights, output$mu1)
weightedStatDiff = ComputeWeightedDifference(output$muDiff, userweights, output$mu1,
statDiff = TRUE, confBand = output$band)
```

*DSWE*version 1.8.2 Index]